diff options
author | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2008-09-09 07:24:30 +0000 |
---|---|---|
committer | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2008-09-09 07:24:30 +0000 |
commit | a35bf7061a7421a9dc8824b31a669e56173771cd (patch) | |
tree | 8256dfe7f973d2089120440e1c8a91be0e2cd6bb /Lib/test/test_long.py | |
parent | 3bb4f7f34b7bad22a1a661aedfa9609305c0ae7a (diff) | |
download | cpython-a35bf7061a7421a9dc8824b31a669e56173771cd.tar.gz |
#3777: long(4.2) returned an int, and broke backward compatibility.
the __long__ slot is allowed to return either int or long, but the behaviour of
float objects should not change between 2.5 and 2.6.
Reviewed by Benjamin Peterson
Diffstat (limited to 'Lib/test/test_long.py')
-rw-r--r-- | Lib/test/test_long.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_long.py b/Lib/test/test_long.py index e53fd058cf..5addd2e875 100644 --- a/Lib/test/test_long.py +++ b/Lib/test/test_long.py @@ -279,6 +279,10 @@ class LongTest(unittest.TestCase): self.assertEqual(long(314), 314L) self.assertEqual(long(3.14), 3L) self.assertEqual(long(314L), 314L) + # Check that long() of basic types actually returns a long + self.assertEqual(type(long(314)), long) + self.assertEqual(type(long(3.14)), long) + self.assertEqual(type(long(314L)), long) # Check that conversion from float truncates towards zero self.assertEqual(long(-3.14), -3L) self.assertEqual(long(3.9), 3L) |