summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2009-05-11 16:09:39 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2009-05-11 16:09:39 (GMT)
commitce05717daa31be8e2bb93e405f8f37fc8d0fe233 (patch)
tree6dee3e221234535df1dfac30be8b64b2e6488763 /Lib
parentfd9258d0dd959cd15abfef8decb9021e061e425d (diff)
downloadcpython-ce05717daa31be8e2bb93e405f8f37fc8d0fe233.zip
cpython-ce05717daa31be8e2bb93e405f8f37fc8d0fe233.tar.gz
cpython-ce05717daa31be8e2bb93e405f8f37fc8d0fe233.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')
-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;