Commit d4313742 authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #29073: Added a test for bytearray formatting with null byte.

parents fc600834 b7fc5e42
......@@ -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")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment