summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_format.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-12-28 07:54:22 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-12-28 07:54:22 (GMT)
commitc9ad8b7a2384f063dc0a99c652dccd9e7616e14e (patch)
treef9644fc5b99777b4667fe4dc035514d0ea9cedcd /Lib/test/test_format.py
parentaf9181a4f2498a0a722fcd9044b66106640cf4df (diff)
downloadcpython-c9ad8b7a2384f063dc0a99c652dccd9e7616e14e.zip
cpython-c9ad8b7a2384f063dc0a99c652dccd9e7616e14e.tar.gz
cpython-c9ad8b7a2384f063dc0a99c652dccd9e7616e14e.tar.bz2
Issue #29073: bytearray formatting no longer truncates on first null byte.
Diffstat (limited to 'Lib/test/test_format.py')
-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 0e83a69..565bb79 100644
--- a/Lib/test/test_format.py
+++ b/Lib/test/test_format.py
@@ -388,6 +388,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")