8000 bpo-44678: Separate error message for discontinuous padding in binascii.a2b_base64 strict mode by idan22moral · Pull Request #27249 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-44678: Separate error message for discontinuous padding in binascii.a2b_base64 strict mode #27249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 19, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Renamed assertLeadingPadding function to match logic
  • Loading branch information
idan22moral committed Jul 19, 2021
commit 11ea63826a40a6fd41239f40a217c66c2b30ef73
12 changes: 6 additions & 6 deletions Lib/test/test_binascii.py
Original file line number Diff line number Diff line change
8855 Expand Up @@ -130,7 +130,7 @@ def assertExcessData(data, non_strict_mode_expected_result: bytes):
def assertNonBase64Data(data, non_strict_mode_expected_result: bytes):
_assertRegexTemplate(r'(?i)Only base64 data', data, non_strict_mode_expected_result)

def assertMalformedPadding(data, non_strict_mode_expected_result: bytes):
def assertLeadingPadding(data, non_strict_mode_expected_result: bytes):
_assertRegexTemplate(r'(?i)Leading padding', data, non_strict_mode_expected_result)

# Test excess data exceptions
Expand All @@ -148,11 +148,11 @@ def assertMalformedPadding(data, non_strict_mode_expected_result: bytes):
assertNonBase64Data(b'a\x00b==', b'i')

# Test malformed padding
assertMalformedPadding(b'=', b'')
assertMalformedPadding(b'==', b'')
assertMalformedPadding(b'===', b'')
assertMalformedPadding(b'ab=c=', b'i\xb7')
assertMalformedPadding(b'ab=ab==', b'i\xb6\x9b')
assertLeadingPadding(b'=', b'')
assertLeadingPadding(b'==', b'')
assertLeadingPadding(b'===', b'')
assertLeadingPadding(b'ab=c=', b'i\xb7')
assertLeadingPadding(b'ab=ab==', b'i\xb6\x9b')


def test_base64errors(self):
Expand Down
0