Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c33b6fb

Browse files
gh-127740: Add some more tests for earlier PR #127756 (#127818)
1 parent 41f29e5 commit c33b6fb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Lib/test/test_bytes.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,10 @@ def test_fromhex(self):
464464
with self.assertRaises(ValueError) as cm:
465465
self.type2test.fromhex(value)
466466
self.assertIn("fromhex() arg must contain an even number of hexadecimal digits", str(cm.exception))
467+
for value, position in (("a ", 1), (" aa a ", 5), (" aa a a ", 5)):
468+
with self.assertRaises(ValueError) as cm:
469+
self.type2test.fromhex(value)
470+
self.assertIn(f"non-hexadecimal number found in fromhex() arg at position {position}", str(cm.exception))
467471

468472
for data, pos in (
469473
# invalid first hexadecimal character

0 commit comments

Comments
 (0)