mirror of
https://github.com/python/cpython.git
synced 2025-10-03 05:35:59 +00:00
[3.12] gh-74678: Increase base64 test coverage (GH-21913) (GH-113811)
Ensure the character y is disallowed within an Ascii85 5-tuple.
(cherry picked from commit 802d4954f1
)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Co-authored-by: Lee Cannon <leecannon@leecannon.xyz>
This commit is contained in:
parent
ad2d5ec97e
commit
7390dffce0
1 changed files with 3 additions and 0 deletions
|
@ -586,6 +586,7 @@ class BaseXYTestCase(unittest.TestCase):
|
||||||
eq(base64.a85decode(b'y+<Vd', foldspaces=True, adobe=False), b' '*7)
|
eq(base64.a85decode(b'y+<Vd', foldspaces=True, adobe=False), b' '*7)
|
||||||
eq(base64.a85decode(b'y+<U', foldspaces=True, adobe=False), b' '*6)
|
eq(base64.a85decode(b'y+<U', foldspaces=True, adobe=False), b' '*6)
|
||||||
eq(base64.a85decode(b'y+9', foldspaces=True, adobe=False), b' '*5)
|
eq(base64.a85decode(b'y+9', foldspaces=True, adobe=False), b' '*5)
|
||||||
|
eq(base64.a85decode(b'aaaaay', foldspaces=True), b'\xc9\x80\x0b@ ')
|
||||||
|
|
||||||
self.check_other_types(base64.a85decode, b'GB\\6`E-ZP=Df.1GEb>',
|
self.check_other_types(base64.a85decode, b'GB\\6`E-ZP=Df.1GEb>',
|
||||||
b"www.python.org")
|
b"www.python.org")
|
||||||
|
@ -689,6 +690,8 @@ class BaseXYTestCase(unittest.TestCase):
|
||||||
self.assertRaises(ValueError, base64.a85decode, b's8W', adobe=False)
|
self.assertRaises(ValueError, base64.a85decode, b's8W', adobe=False)
|
||||||
self.assertRaises(ValueError, base64.a85decode, b's8W-', adobe=False)
|
self.assertRaises(ValueError, base64.a85decode, b's8W-', adobe=False)
|
||||||
self.assertRaises(ValueError, base64.a85decode, b's8W-"', adobe=False)
|
self.assertRaises(ValueError, base64.a85decode, b's8W-"', adobe=False)
|
||||||
|
self.assertRaises(ValueError, base64.a85decode, b'aaaay',
|
||||||
|
foldspaces=True)
|
||||||
|
|
||||||
def test_b85decode_errors(self):
|
def test_b85decode_errors(self):
|
||||||
illegal = list(range(33)) + \
|
illegal = list(range(33)) + \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue