diff options
author | Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి) <thatiparthysreenivas@gmail.com> | 2024-12-12 02:18:12 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-12 02:18:12 (GMT) |
commit | c33b6fbf358c1bc14b20e14a1fffff62c6826ecd (patch) | |
tree | 39b1ec86950f5660c28b033c745fb78d985931a0 | |
parent | 41f29e5d16c314790559e563ce5ca0334fcd54df (diff) | |
download | cpython-c33b6fbf358c1bc14b20e14a1fffff62c6826ecd.zip cpython-c33b6fbf358c1bc14b20e14a1fffff62c6826ecd.tar.gz cpython-c33b6fbf358c1bc14b20e14a1fffff62c6826ecd.tar.bz2 |
gh-127740: Add some more tests for earlier PR #127756 (#127818)
-rw-r--r-- | Lib/test/test_bytes.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py index 32cd178..7bb1ab3 100644 --- a/Lib/test/test_bytes.py +++ b/Lib/test/test_bytes.py @@ -464,6 +464,10 @@ class BaseBytesTest: with self.assertRaises(ValueError) as cm: self.type2test.fromhex(value) self.assertIn("fromhex() arg must contain an even number of hexadecimal digits", str(cm.exception)) + for value, position in (("a ", 1), (" aa a ", 5), (" aa a a ", 5)): + with self.assertRaises(ValueError) as cm: + self.type2test.fromhex(value) + self.assertIn(f"non-hexadecimal number found in fromhex() arg at position {position}", str(cm.exception)) for data, pos in ( # invalid first hexadecimal character |