gh-127740: Add some more tests for earlier PR #127756 (#127818)

This commit is contained in:
Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి) 2024-12-12 07:48:12 +05:30 committed by GitHub
parent 41f29e5d16
commit c33b6fbf35
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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