diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2019-09-01 09:16:51 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-01 09:16:51 (GMT) |
commit | 1f21eaa15e8a0d2b0f78d0e3f2b9e5b458eb0a70 (patch) | |
tree | 8db3de2421c1d45d018a7a1dc03f42a0797acee2 /Lib/test/test_builtin.py | |
parent | 5eca7f3f3836cc734dfe8dc5ec669f3b4e9333fe (diff) | |
download | cpython-1f21eaa15e8a0d2b0f78d0e3f2b9e5b458eb0a70.zip cpython-1f21eaa15e8a0d2b0f78d0e3f2b9e5b458eb0a70.tar.gz cpython-1f21eaa15e8a0d2b0f78d0e3f2b9e5b458eb0a70.tar.bz2 |
bpo-15999: Clean up of handling boolean arguments. (GH-15610)
* Use the 'p' format unit instead of manually called PyObject_IsTrue().
* Pass boolean value instead 0/1 integers to functions that needs boolean.
* Convert some arguments to boolean only once.
Diffstat (limited to 'Lib/test/test_builtin.py')
-rw-r--r-- | Lib/test/test_builtin.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py index 1100c49..db2f6cd 100644 --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -320,8 +320,8 @@ class BuiltinTest(unittest.TestCase): bom = b'\xef\xbb\xbf' compile(bom + b'print(1)\n', '', 'exec') compile(source='pass', filename='?', mode='exec') - compile(dont_inherit=0, filename='tmp', source='0', mode='eval') - compile('pass', '?', dont_inherit=1, mode='exec') + compile(dont_inherit=False, filename='tmp', source='0', mode='eval') + compile('pass', '?', dont_inherit=True, mode='exec') compile(memoryview(b"text"), "name", "exec") self.assertRaises(TypeError, compile) self.assertRaises(ValueError, compile, 'print(42)\n', '<string>', 'badmode') @@ -1853,7 +1853,7 @@ class TestSorted(unittest.TestCase): self.assertEqual(data, sorted(copy, key=lambda x: -x)) self.assertNotEqual(data, copy) random.shuffle(copy) - self.assertEqual(data, sorted(copy, reverse=1)) + self.assertEqual(data, sorted(copy, reverse=True)) self.assertNotEqual(data, copy) def test_bad_arguments(self): |