mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Make tset_float pass. float(<unicode>) was never very good -- it used
a fixed-length buffer of 256 bytes.
This commit is contained in:
parent
a28c291e92
commit
2be161dcfa
2 changed files with 29 additions and 21 deletions
|
@ -39,15 +39,15 @@ class FormatFunctionsTestCase(unittest.TestCase):
|
|||
self.assertRaises(ValueError, float.__setformat__,
|
||||
'chicken', 'unknown')
|
||||
|
||||
BE_DOUBLE_INF = '\x7f\xf0\x00\x00\x00\x00\x00\x00'
|
||||
LE_DOUBLE_INF = ''.join(reversed(BE_DOUBLE_INF))
|
||||
BE_DOUBLE_NAN = '\x7f\xf8\x00\x00\x00\x00\x00\x00'
|
||||
LE_DOUBLE_NAN = ''.join(reversed(BE_DOUBLE_NAN))
|
||||
BE_DOUBLE_INF = b'\x7f\xf0\x00\x00\x00\x00\x00\x00'
|
||||
LE_DOUBLE_INF = bytes(reversed(BE_DOUBLE_INF))
|
||||
BE_DOUBLE_NAN = b'\x7f\xf8\x00\x00\x00\x00\x00\x00'
|
||||
LE_DOUBLE_NAN = bytes(reversed(BE_DOUBLE_NAN))
|
||||
|
||||
BE_FLOAT_INF = '\x7f\x80\x00\x00'
|
||||
LE_FLOAT_INF = ''.join(reversed(BE_FLOAT_INF))
|
||||
BE_FLOAT_NAN = '\x7f\xc0\x00\x00'
|
||||
LE_FLOAT_NAN = ''.join(reversed(BE_FLOAT_NAN))
|
||||
BE_FLOAT_INF = b'\x7f\x80\x00\x00'
|
||||
LE_FLOAT_INF = bytes(reversed(BE_FLOAT_INF))
|
||||
BE_FLOAT_NAN = b'\x7f\xc0\x00\x00'
|
||||
LE_FLOAT_NAN = bytes(reversed(BE_FLOAT_NAN))
|
||||
|
||||
# on non-IEEE platforms, attempting to unpack a bit pattern
|
||||
# representing an infinity or a NaN should raise an exception.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue