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_unicode.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_unicode.py')
-rw-r--r-- | Lib/test/test_unicode.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index 7bd7f51..8636f2b 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -2820,15 +2820,15 @@ class CAPITest(unittest.TestCase): for s in ['abc', '\xa1\xa2', '\u4f60\u597d', 'a\U0001f600', 'a\ud800b\udfffc', '\ud834\udd1e']: l = len(s) - self.assertEqual(unicode_asucs4(s, l, 1), s+'\0') - self.assertEqual(unicode_asucs4(s, l, 0), s+'\uffff') - self.assertEqual(unicode_asucs4(s, l+1, 1), s+'\0\uffff') - self.assertEqual(unicode_asucs4(s, l+1, 0), s+'\0\uffff') - self.assertRaises(SystemError, unicode_asucs4, s, l-1, 1) - self.assertRaises(SystemError, unicode_asucs4, s, l-2, 0) + self.assertEqual(unicode_asucs4(s, l, True), s+'\0') + self.assertEqual(unicode_asucs4(s, l, False), s+'\uffff') + self.assertEqual(unicode_asucs4(s, l+1, True), s+'\0\uffff') + self.assertEqual(unicode_asucs4(s, l+1, False), s+'\0\uffff') + self.assertRaises(SystemError, unicode_asucs4, s, l-1, True) + self.assertRaises(SystemError, unicode_asucs4, s, l-2, False) s = '\0'.join([s, s]) - self.assertEqual(unicode_asucs4(s, len(s), 1), s+'\0') - self.assertEqual(unicode_asucs4(s, len(s), 0), s+'\uffff') + self.assertEqual(unicode_asucs4(s, len(s), True), s+'\0') + self.assertEqual(unicode_asucs4(s, len(s), False), s+'\uffff') # Test PyUnicode_AsUTF8() @support.cpython_only |