MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_decodebytes

Method test_decodebytes

Lib/test/test_base64.py:50–69  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

48 self.check_type_errors(base64.encodebytes)
49
50 def test_decodebytes(self):
51 eq = self.assertEqual
52 eq(base64.decodebytes(b"d3d3LnB5dGhvbi5vcmc=\n"), b"www.python.org")
53 eq(base64.decodebytes(b"YQ==\n"), b"a")
54 eq(base64.decodebytes(b"YWI=\n"), b"ab")
55 eq(base64.decodebytes(b"YWJj\n"), b"abc")
56 eq(base64.decodebytes(b"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNE"
57 b"RUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0\nNT"
58 b"Y3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ==\n"),
59 b"abcdefghijklmnopqrstuvwxyz"
60 b"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
61 b"0123456789!@#0^&*();:<>,. []{}")
62 eq(base64.decodebytes(b''), b'')
63 eq(base64.decodebytes(b"QWxhZGRpbjpvcGVuIHNlc2FtZQ==\n"),
64 b"Aladdin:open sesame")
65 # Non-bytes
66 eq(base64.decodebytes(bytearray(b'YWJj\n')), b'abc')
67 eq(base64.decodebytes(memoryview(b'YWJj\n')), b'abc')
68 eq(base64.decodebytes(array('B', b'YWJj\n')), b'abc')
69 self.check_type_errors(base64.decodebytes)
70
71 def test_encode(self):
72 eq = self.assertEqual

Callers

nothing calls this directly

Calls 3

check_type_errorsMethod · 0.95
arrayClass · 0.85
eqFunction · 0.50

Tested by

no test coverage detected