summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_float.py
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2009-05-11 15:45:15 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2009-05-11 15:45:15 (GMT)
commitd1ec8b2bda96ada31af086262392c19712d114be (patch)
tree800e03193eb1378f66a690f19d791b35b3355763 /Lib/test/test_float.py
parent3bd31a266b42b66f59a3dd161aea34e3441663ad (diff)
downloadcpython-d1ec8b2bda96ada31af086262392c19712d114be.zip
cpython-d1ec8b2bda96ada31af086262392c19712d114be.tar.gz
cpython-d1ec8b2bda96ada31af086262392c19712d114be.tar.bz2
Merged revisions 72564 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r72564 | mark.dickinson | 2009-05-11 16:33:08 +0100 (Mon, 11 May 2009) | 2 lines Issue #5981: Fix some float.fromhex bugs related to inf and nan handling. ........
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 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;