summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_float.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_float.py')
-rw-r--r--Lib/test/test_float.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py
index 0b1ae96..23c0c54 100644
--- a/Lib/test/test_float.py
+++ b/Lib/test/test_float.py
@@ -391,6 +391,11 @@ class HexFloatTestCase(unittest.TestCase):
'snan',
'NaNs',
'nna',
+ 'an',
+ 'nf',
+ 'nfinity',
+ 'inity',
+ 'iinity',
'0xnan',
'',
' ',
@@ -439,6 +444,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;