1. Olemis Lang
  2. pypy

Commits

Konstantin Lopuhin  committed 99ddf04

#1180 - not a proper fix, but all tests pass - the fix should be more general

  • Participants
  • Parent commits eea3fba
  • Branches default

Comments (0)

Files changed (2)

File pypy/objspace/std/newformat.py

View file
             return self.empty.join(buf[i:])
         
         def format_bool(self, w_bool):
-            return self.space.str(w_bool)
+            # FIXME - this is not a proper fix
+            if self.spec:
+                return self.format_int_or_long(w_bool, INT_KIND) 
+            else:
+                return self.space.str(w_bool)
 
         def format_int_or_long(self, w_num, kind):
             space = self.space

File pypy/objspace/std/test/test_newformat.py

View file
 class AppTestBoolFormat:
 
     def test_simple(self):
+        assert format(False) == "False"
+        assert format(True) == "True"
         assert "{0}".format(True) == "True"
         assert "{0}".format(False) == "False"
-        assert format(False) == "False"
-        assert format(True) == "True"
+        assert "{0} or {1}".format(True, False) == "True or False"
 
     def test_with_format(self):
         assert "{:f}".format(True) == "1.000000"