[Python-checkins] cpython (merge 3.5 -> 3.6): Issue #29073: Added a test for bytearray formatting with null byte.

serhiy.storchaka python-checkins at python.org
Wed Dec 28 02:57:26 EST 2016


https://hg.python.org/cpython/rev/9b77e3a586b0
changeset: 105865:9b77e3a586b0
branch: 3.6
parent: 105860:e44b6b01c8cf
parent: 105864:277b36596a54
user: Serhiy Storchaka <storchaka at gmail.com>
date: Wed Dec 28 09:56:52 2016 +0200
summary:
 Issue #29073: Added a test for bytearray formatting with null byte.
files:
 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
--- a/Lib/test/test_format.py
+++ b/Lib/test/test_format.py
@@ -390,6 +390,13 @@
 else:
 raise TestFailed('"%*d"%(maxsize, -127) should fail')
 
+ def test_nul(self):
+ # test the null character
+ testcommon("a0円b", (), 'a0円b')
+ testcommon("a%cb", (0,), 'a0円b')
+ testformat("a%sb", ('c0円d',), 'ac0円db')
+ testcommon(b"a%sb", (b'c0円d',), b'ac0円db')
+
 def test_non_ascii(self):
 testformat("\u20ac=%f", (1.0,), "\u20ac=1.000000")
 
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /