diff options
author | 2014-11-07 14:04:37 +0200 | |
---|---|---|
committer | 2014-11-07 14:04:37 +0200 | |
commit | 519114df4258f17bc33a31c6c1614fd82e2ab0be (patch) | |
tree | 4f29d5972347ee48ec81fd6219e79fcdd5464d45 /Lib/test/test_uu.py | |
parent | Issue #17293: uuid.getnode() now determines MAC address on AIX using netstat. (diff) | |
download | cpython-519114df4258f17bc33a31c6c1614fd82e2ab0be.tar.gz cpython-519114df4258f17bc33a31c6c1614fd82e2ab0be.tar.bz2 cpython-519114df4258f17bc33a31c6c1614fd82e2ab0be.zip |
Issue #22406: Fixed the uu_codec codec incorrectly ported to 3.x.
Based on patch by Martin Panter.
Diffstat (limited to 'Lib/test/test_uu.py')
-rw-r--r-- | Lib/test/test_uu.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Lib/test/test_uu.py b/Lib/test/test_uu.py index cbf6724fd2d..25fffbf9936 100644 --- a/Lib/test/test_uu.py +++ b/Lib/test/test_uu.py @@ -93,6 +93,28 @@ class UUTest(unittest.TestCase): except uu.Error as e: self.assertEqual(str(e), "No valid begin line found in input file") + def test_garbage_padding(self): + # Issue #22406 + encodedtext = ( + b"begin 644 file\n" + # length 1; bits 001100 111111 111111 111111 + b"\x21\x2C\x5F\x5F\x5F\n" + b"\x20\n" + b"end\n" + ) + plaintext = b"\x33" # 00110011 + + with self.subTest("uu.decode()"): + inp = io.BytesIO(encodedtext) + out = io.BytesIO() + uu.decode(inp, out, quiet=True) + self.assertEqual(out.getvalue(), plaintext) + + with self.subTest("uu_codec"): + import codecs + decoded = codecs.decode(encodedtext, "uu_codec") + self.assertEqual(decoded, plaintext) + class UUStdIOTest(unittest.TestCase): def setUp(self): |