summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-12-28 07:57:11 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-12-28 07:57:11 (GMT)
commitd4313742fd17b64ff8fb563f48b1b87c4bbd9015 (patch)
tree85f009a3a0e4270c1d7309a88c49c89390c94f7f
parentfc600834d8a8d2b724b86d187da4abc42275ab0a (diff)
parentb7fc5e42c505e7bc23215db7d97ec23673abac4f (diff)
downloadcpython-d4313742fd17b64ff8fb563f48b1b87c4bbd9015.zip
cpython-d4313742fd17b64ff8fb563f48b1b87c4bbd9015.tar.gz
cpython-d4313742fd17b64ff8fb563f48b1b87c4bbd9015.tar.bz2
Issue #29073: Added a test for bytearray formatting with null byte.
-rw-r--r--Lib/test/test_format.py7
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")