diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2017-01-27 13:05:09 +0000 |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2017-01-27 13:05:09 +0000 |
commit | d45d8652710e51576367db00b226b8465e6c5ce6 (patch) | |
tree | eeb12605abc98507852e82848382c2e739991708 /Lib/test/test_bytes.py | |
parent | 6ccbbb38caa79f9eb9b93b5767f3787fc80cbac1 (diff) | |
parent | bbbab3c96168cea9f872f90da0a385b50f62ca70 (diff) | |
download | cpython-d45d8652710e51576367db00b226b8465e6c5ce6.tar.gz |
Closes #28784: Merged update from 3.6.
Diffstat (limited to 'Lib/test/test_bytes.py')
-rw-r--r-- | Lib/test/test_bytes.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py index a103a7d39c..671c35efab 100644 --- a/Lib/test/test_bytes.py +++ b/Lib/test/test_bytes.py @@ -306,6 +306,14 @@ class BaseBytesTest: b = bytearray([0x1a, 0x2b, 0x30]) self.assertEqual(self.type2test.fromhex('1a2B30'), b) self.assertEqual(self.type2test.fromhex(' 1A 2B 30 '), b) + + # check that ASCII whitespace is ignored + self.assertEqual(self.type2test.fromhex(' 1A\n2B\t30\v'), b) + for c in "\x09\x0A\x0B\x0C\x0D\x20": + self.assertEqual(self.type2test.fromhex(c), self.type2test()) + for c in "\x1C\x1D\x1E\x1F\x85\xa0\u2000\u2002\u2028": + self.assertRaises(ValueError, self.type2test.fromhex, c) + self.assertEqual(self.type2test.fromhex('0000'), b'\0\0') self.assertRaises(TypeError, self.type2test.fromhex, b'1B') self.assertRaises(ValueError, self.type2test.fromhex, 'a') |