8000 gh-119780: Adjust exception messages in Lib/test/test_format.py by skirpichev · Pull Request #119781 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-119780: Adjust exception messages in Lib/test/test_format.py #119781

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
May 31, 2024
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
gh-119780: Adjust exception messages in Lib/test/test_format.py
  • Loading branch information
skirpichev committed May 30, 2024
commit 7849c66e8adbaaddc6f4c9806d409981277feb88
12 changes: 6 additions & 6 deletions Lib/test/test_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,9 @@ def test_str_format(self):
test_exc('%c', sys.maxunicode+1, OverflowError,
"%c arg not in range(0x110000)")
#test_exc('%c', 2**128, OverflowError, "%c arg not in range(0x110000)")
test_exc('%c', 3.14, TypeError, "%c requires int or char")
test_exc('%c', 'ab', TypeError, "%c requires int or char")
test_exc('%c', b'x', TypeError, "%c requires int or char")
test_exc('%c', 3.14, TypeError, "%c requires an int or a unicode character, not float")
test_exc('%c', 'ab', TypeError, "%c requires an int or a unicode character, not a string of length 2")
test_exc('%c', b'x', TypeError, "%c requires an int or a unicode character, not bytes")

if maxsize == 2**31-1:
# crashes 2.2.1 and earlier:
Expand Down Expand Up @@ -370,11 +370,11 @@ def __bytes__(self):
test_exc(b"%c", 2**128, OverflowError,
"%c arg not in range(256)")
test_exc(b"%c", b"Za", TypeError,
"%c requires an integer in range(256) or a single byte")
"%c requires an integer in range(256) or a single byte, not a bytes object of length 2")
test_exc(b"%c", "Y", TypeError,
"%c requires an integer in range(256) or a single byte")
"%c requires an integer in range(256) or a single byte, not str")
test_exc(b"%c", 3.14, TypeError,
"%c requires an integer in range(256) or a single byte")
"%c requires an integer in range(256) or a single byte, not float")
test_exc(b"%b", "Xc", TypeError,
"%b requires a bytes-like object, "
"or an object that implements __bytes__, not 'str'")
Expand Down
0