]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-127740: Add some more tests for earlier PR #127756 (#127818)
authorSrinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి) <thatiparthysreenivas@gmail.com>
Thu, 12 Dec 2024 02:18:12 +0000 (07:48 +0530)
committerGitHub <noreply@github.com>
Thu, 12 Dec 2024 02:18:12 +0000 (02:18 +0000)
Lib/test/test_bytes.py

index 32cd178fa3b445ab08cfc7713e802ef80130d88b..7bb1ab38aa4fdf2230d370a84c199bffdced8b82 100644 (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