diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-12-28 07:56:52 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-12-28 07:56:52 (GMT) |
commit | b7fc5e42c505e7bc23215db7d97ec23673abac4f (patch) | |
tree | 23c31d55f1b4db616ed3eb7ad5198bfbd60680b4 | |
parent | 44223e9550e4dd615080f8b3f5cd5f6332cb057f (diff) | |
parent | c9ad8b7a2384f063dc0a99c652dccd9e7616e14e (diff) | |
download | cpython-b7fc5e42c505e7bc23215db7d97ec23673abac4f.zip cpython-b7fc5e42c505e7bc23215db7d97ec23673abac4f.tar.gz cpython-b7fc5e42c505e7bc23215db7d97ec23673abac4f.tar.bz2 |
Issue #29073: Added a test for bytearray formatting with null byte.
-rw-r--r-- | Lib/test/test_format.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_format.py b/Lib/test/test_format.py index da635a9..83eb29f 100644 --- a/Lib/test/test_format.py +++ b/Lib/test/test_format.py @@ -390,6 +390,13 @@ class FormatTest(unittest.TestCase): else: raise TestFailed('"%*d"%(maxsize, -127) should fail') + def test_nul(self): + # test the null character + testcommon("a\0b", (), 'a\0b') + testcommon("a%cb", (0,), 'a\0b') + testformat("a%sb", ('c\0d',), 'ac\0db') + testcommon(b"a%sb", (b'c\0d',), b'ac\0db') + def test_non_ascii(self): testformat("\u20ac=%f", (1.0,), "\u20ac=1.000000") |