mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
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. ........
This commit is contained in:
parent
3bd31a266b
commit
d1ec8b2bda
3 changed files with 73 additions and 16 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue