|
6 | 6 |
|
7 | 7 |
|
8 | 8 | class LegacyBase64TestCase(unittest.TestCase): |
9 | | - def test_encodestring(self): |
| 9 | + def test_encodebytes(self): |
10 | 10 | eq = self.assertEqual |
11 | | - eq(base64.encodestring(b"www.python.org"), b"d3d3LnB5dGhvbi5vcmc=\n") |
12 | | - eq(base64.encodestring(b"a"), b"YQ==\n") |
13 | | - eq(base64.encodestring(b"ab"), b"YWI=\n") |
14 | | - eq(base64.encodestring(b"abc"), b"YWJj\n") |
15 | | - eq(base64.encodestring(b""), b"") |
16 | | - eq(base64.encodestring(b"abcdefghijklmnopqrstuvwxyz" |
| 11 | + eq(base64.encodebytes(b"www.python.org"), b"d3d3LnB5dGhvbi5vcmc=\n") |
| 12 | + eq(base64.encodebytes(b"a"), b"YQ==\n") |
| 13 | + eq(base64.encodebytes(b"ab"), b"YWI=\n") |
| 14 | + eq(base64.encodebytes(b"abc"), b"YWJj\n") |
| 15 | + eq(base64.encodebytes(b""), b"") |
| 16 | + eq(base64.encodebytes(b"abcdefghijklmnopqrstuvwxyz" |
17 | 17 | b"ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
18 | 18 | b"0123456789!@#0^&*();:<>,. []{}"), |
19 | 19 | b"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNE" |
20 | 20 | b"RUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0\nNT" |
21 | 21 | b"Y3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ==\n") |
22 | | - self.assertRaises(TypeError, base64.encodestring, "") |
| 22 | + self.assertRaises(TypeError, base64.encodebytes, "") |
23 | 23 |
|
24 | | - def test_decodestring(self): |
| 24 | + def test_decodebytes(self): |
25 | 25 | eq = self.assertEqual |
26 | | - eq(base64.decodestring(b"d3d3LnB5dGhvbi5vcmc=\n"), b"www.python.org") |
27 | | - eq(base64.decodestring(b"YQ==\n"), b"a") |
28 | | - eq(base64.decodestring(b"YWI=\n"), b"ab") |
29 | | - eq(base64.decodestring(b"YWJj\n"), b"abc") |
30 | | - eq(base64.decodestring(b"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNE" |
| 26 | + eq(base64.decodebytes(b"d3d3LnB5dGhvbi5vcmc=\n"), b"www.python.org") |
| 27 | + eq(base64.decodebytes(b"YQ==\n"), b"a") |
| 28 | + eq(base64.decodebytes(b"YWI=\n"), b"ab") |
| 29 | + eq(base64.decodebytes(b"YWJj\n"), b"abc") |
| 30 | + eq(base64.decodebytes(b"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNE" |
31 | 31 | b"RUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0\nNT" |
32 | 32 | b"Y3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ==\n"), |
33 | 33 | b"abcdefghijklmnopqrstuvwxyz" |
34 | 34 | b"ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
35 | 35 | b"0123456789!@#0^&*();:<>,. []{}") |
36 | | - eq(base64.decodestring(b''), b'') |
37 | | - self.assertRaises(TypeError, base64.decodestring, "") |
| 36 | + eq(base64.decodebytes(b''), b'') |
| 37 | + self.assertRaises(TypeError, base64.decodebytes, "") |
38 | 38 |
|
39 | 39 | def test_encode(self): |
40 | 40 | eq = self.assertEqual |
|
0 commit comments