Issue #5981: Fix some float.fromhex bugs related to inf and nan handling.
diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py
index 1c6c412..345a815 100644
--- a/Lib/test/test_float.py
+++ b/Lib/test/test_float.py
@@ -462,6 +462,11 @@
             'snan',
             'NaNs',
             'nna',
+            'an',
+            'nf',
+            'nfinity',
+            'inity',
+            'iinity',
             '0xnan',
             '',
             ' ',
@@ -510,6 +515,32 @@
                           '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;