diff options
Diffstat (limited to 'Lib/test/test_float.py')
-rw-r--r-- | Lib/test/test_float.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py index c259d4f..b4b62f0 100644 --- a/Lib/test/test_float.py +++ b/Lib/test/test_float.py @@ -615,6 +615,11 @@ class HexFloatTestCase(unittest.TestCase): 'snan', 'NaNs', 'nna', + 'an', + 'nf', + 'nfinity', + 'inity', + 'iinity', '0xnan', '', ' ', @@ -663,6 +668,32 @@ class HexFloatTestCase(unittest.TestCase): 'got %r instead' % (x, result)) + def test_whitespace(self): + value_pairs = [ + ('inf', INF), + ('-Infinity', -INF), + ('nan', NAN), + ('1.0', 1.0), + ('-0x.2', -0.125), + ('-0.0', -0.0) + ] + whitespace = [ + '', + ' ', + '\t', + '\n', + '\n \t', + '\f', + '\v', + '\r' + ] + for inp, expected in value_pairs: + for lead in whitespace: + for trail in whitespace: + got = fromHex(lead + inp + trail) + self.identical(got, expected) + + def test_from_hex(self): MIN = self.MIN; MAX = self.MAX; |