mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Format bools properly in %d.
This commit is contained in:
parent
3eed765223
commit
ff398c6f95
2 changed files with 11 additions and 2 deletions
|
@ -163,6 +163,12 @@ class BoolTest(unittest.TestCase):
|
|||
self.assertIs(bool(""), False)
|
||||
self.assertIs(bool(), False)
|
||||
|
||||
def test_format(self):
|
||||
self.assertEqual("%d" % False, "0")
|
||||
self.assertEqual("%d" % True, "1")
|
||||
self.assertEqual("%x" % False, "0")
|
||||
self.assertEqual("%x" % True, "1")
|
||||
|
||||
def test_hasattr(self):
|
||||
self.assertIs(hasattr([], "append"), True)
|
||||
self.assertIs(hasattr([], "wobble"), False)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue