Skip to content

Commit

Permalink
add test case for pythongh-118314
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyoufu committed Apr 26, 2024
1 parent 463c20d commit f02dbad
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Lib/test/test_binascii.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ def assertLeadingPadding(data, non_strict_mode_expected_result: bytes):
def assertDiscontinuousPadding(data, non_strict_mode_expected_result: bytes):
_assertRegexTemplate(r'(?i)Discontinuous padding', data, non_strict_mode_expected_result)

def assertIncorrectPadding(data, non_strict_mode_expected_result: bytes):
_assertRegexTemplate(r'(?i)Incorrect padding', data, non_strict_mode_expected_result)

# Test excess data exceptions
assertExcessData(b'ab==a', b'i')
assertExcessData(b'ab===', b'i')
Expand All @@ -159,6 +162,9 @@ def assertDiscontinuousPadding(data, non_strict_mode_expected_result: bytes):
assertLeadingPadding(b'===', b'')
assertDiscontinuousPadding(b'ab=c=', b'i\xb7')
assertDiscontinuousPadding(b'ab=ab==', b'i\xb6\x9b')
assertIncorrectPadding(b'AAAA=', b'\x00\x00\x00')
assertIncorrectPadding(b'AAAA==', b'\x00\x00\x00')
assertIncorrectPadding(b'AAAA===', b'\x00\x00\x00')


def test_base64errors(self):
Expand Down

0 comments on commit f02dbad

Please sign in to comment.