diff options
author | Georg Brandl <georg@python.org> | 2009-06-04 09:11:51 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-06-04 09:11:51 (GMT) |
commit | b54d801280e3f510782e2855504710947d10f053 (patch) | |
tree | 457166089bbc17f190eb7140755c7948e2918829 /Lib/test/test_base64.py | |
parent | cef803f82c82017b734dd4264478ae6f02ce21f5 (diff) | |
download | cpython-b54d801280e3f510782e2855504710947d10f053.zip cpython-b54d801280e3f510782e2855504710947d10f053.tar.gz cpython-b54d801280e3f510782e2855504710947d10f053.tar.bz2 |
#3613: add base64.encodebytes and decodebytes as the new spelling of encodestring and decodestring; deprecate the latter.
Diffstat (limited to 'Lib/test/test_base64.py')
-rw-r--r-- | Lib/test/test_base64.py | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/Lib/test/test_base64.py b/Lib/test/test_base64.py index e899016..149ac8a 100644 --- a/Lib/test/test_base64.py +++ b/Lib/test/test_base64.py @@ -6,35 +6,35 @@ import binascii class LegacyBase64TestCase(unittest.TestCase): - def test_encodestring(self): + def test_encodebytes(self): eq = self.assertEqual - eq(base64.encodestring(b"www.python.org"), b"d3d3LnB5dGhvbi5vcmc=\n") - eq(base64.encodestring(b"a"), b"YQ==\n") - eq(base64.encodestring(b"ab"), b"YWI=\n") - eq(base64.encodestring(b"abc"), b"YWJj\n") - eq(base64.encodestring(b""), b"") - eq(base64.encodestring(b"abcdefghijklmnopqrstuvwxyz" + eq(base64.encodebytes(b"www.python.org"), b"d3d3LnB5dGhvbi5vcmc=\n") + eq(base64.encodebytes(b"a"), b"YQ==\n") + eq(base64.encodebytes(b"ab"), b"YWI=\n") + eq(base64.encodebytes(b"abc"), b"YWJj\n") + eq(base64.encodebytes(b""), b"") + eq(base64.encodebytes(b"abcdefghijklmnopqrstuvwxyz" b"ABCDEFGHIJKLMNOPQRSTUVWXYZ" b"0123456789!@#0^&*();:<>,. []{}"), b"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNE" b"RUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0\nNT" b"Y3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ==\n") - self.assertRaises(TypeError, base64.encodestring, "") + self.assertRaises(TypeError, base64.encodebytes, "") - def test_decodestring(self): + def test_decodebytes(self): eq = self.assertEqual - eq(base64.decodestring(b"d3d3LnB5dGhvbi5vcmc=\n"), b"www.python.org") - eq(base64.decodestring(b"YQ==\n"), b"a") - eq(base64.decodestring(b"YWI=\n"), b"ab") - eq(base64.decodestring(b"YWJj\n"), b"abc") - eq(base64.decodestring(b"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNE" + eq(base64.decodebytes(b"d3d3LnB5dGhvbi5vcmc=\n"), b"www.python.org") + eq(base64.decodebytes(b"YQ==\n"), b"a") + eq(base64.decodebytes(b"YWI=\n"), b"ab") + eq(base64.decodebytes(b"YWJj\n"), b"abc") + eq(base64.decodebytes(b"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNE" b"RUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0\nNT" b"Y3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ==\n"), b"abcdefghijklmnopqrstuvwxyz" b"ABCDEFGHIJKLMNOPQRSTUVWXYZ" b"0123456789!@#0^&*();:<>,. []{}") - eq(base64.decodestring(b''), b'') - self.assertRaises(TypeError, base64.decodestring, "") + eq(base64.decodebytes(b''), b'') + self.assertRaises(TypeError, base64.decodebytes, "") def test_encode(self): eq = self.assertEqual |