summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2007-03-13 22:49:43 (GMT)
committerGeorg Brandl <georg@python.org>2007-03-13 22:49:43 (GMT)
commit4aef7275cb993e18cdddf8ae8615d44f757fd717 (patch)
treed5b516f862e170ea3a866807f8e1b4e1947d6284 /Lib/test
parent7e2b6bb24f58d134239cd2641cb5a6b4dbc3c917 (diff)
downloadcpython-4aef7275cb993e18cdddf8ae8615d44f757fd717.zip
cpython-4aef7275cb993e18cdddf8ae8615d44f757fd717.tar.gz
cpython-4aef7275cb993e18cdddf8ae8615d44f757fd717.tar.bz2
Patch #1185447: binascii.b2a_qp() now correctly quotes binary characters
with ASCII value less than 32. Also, it correctly quotes dots only if they occur on a single line, as opposed to the previous behavior of quoting dots if they are the second character of any line.
Diffstat (limited to 'Lib/test')
-rwxr-xr-xLib/test/test_binascii.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_binascii.py b/Lib/test/test_binascii.py
index 8272ad9..ea8be31 100755
--- a/Lib/test/test_binascii.py
+++ b/Lib/test/test_binascii.py
@@ -148,6 +148,15 @@ class BinASCIITest(unittest.TestCase):
"0"*75+"=\r\n=FF\r\n=FF\r\n=FF"
)
+ self.assertEqual(binascii.b2a_qp('\0\n'), '=00\n')
+ self.assertEqual(binascii.b2a_qp('\0\n', quotetabs=True), '=00\n')
+ self.assertEqual(binascii.b2a_qp('foo\tbar\t\n'), 'foo\tbar=09\n')
+ self.assertEqual(binascii.b2a_qp('foo\tbar\t\n', quotetabs=True), 'foo=09bar=09\n')
+
+ self.assertEqual(binascii.b2a_qp('.'), '=2E')
+ self.assertEqual(binascii.b2a_qp('.\n'), '=2E\n')
+ self.assertEqual(binascii.b2a_qp('a.\n'), 'a.\n')
+
def test_empty_string(self):
# A test for SF bug #1022953. Make sure SystemError is not raised.
for n in ['b2a_qp', 'a2b_hex', 'b2a_base64', 'a2b_uu', 'a2b_qp',