diff options
author | Sergey B Kirpichev <skirpichev@gmail.com> | 2024-05-31 08:07:16 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-31 08:07:16 (GMT) |
commit | b278c723d79a238b14e99908e83f4b1b6a39ed3d (patch) | |
tree | e49caccfb539414629c9d734cd222d700f760a68 | |
parent | 010aaa32fb93c5033a698d7213469af02d76fef3 (diff) | |
download | cpython-b278c723d79a238b14e99908e83f4b1b6a39ed3d.zip cpython-b278c723d79a238b14e99908e83f4b1b6a39ed3d.tar.gz cpython-b278c723d79a238b14e99908e83f4b1b6a39ed3d.tar.bz2 |
gh-119780: Adjust exception messages in Lib/test/test_format.py (GH-119781)
Mismatches were just output to the stdout, without making the test failing.
-rw-r--r-- | Lib/test/test_format.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/test/test_format.py b/Lib/test/test_format.py index 8cef621..d202615 100644 --- a/Lib/test/test_format.py +++ b/Lib/test/test_format.py @@ -304,9 +304,9 @@ class FormatTest(unittest.TestCase): 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: @@ -370,11 +370,11 @@ class FormatTest(unittest.TestCase): 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'") |