diff options
author | Guido van Rossum <guido@python.org> | 1998-05-26 14:51:55 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-05-26 14:51:55 (GMT) |
commit | 7462942b69cf28533d175f1d8022924d616c58e8 (patch) | |
tree | 4b06ea95ac872b6926e6e7901863e191ab775d05 /Lib/test | |
parent | f753181272d9f69ec9cea4330cfd0af1fcabc935 (diff) | |
download | cpython-7462942b69cf28533d175f1d8022924d616c58e8.zip cpython-7462942b69cf28533d175f1d8022924d616c58e8.tar.gz cpython-7462942b69cf28533d175f1d8022924d616c58e8.tar.bz2 |
Added some tests to make sure that long->int conversions near
sys.maxint and near -sys.maxint-1 work correctly.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_types.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py index 6be66ca..685c05b 100644 --- a/Lib/test/test_types.py +++ b/Lib/test/test_types.py @@ -78,6 +78,18 @@ if (-12L) + 24L <> 12L: raise TestFailed, 'long op' if (-12L) + (-24L) <> -36L: raise TestFailed, 'long op' if not 12L < 24L: raise TestFailed, 'long op' if not -24L < -12L: raise TestFailed, 'long op' +x = sys.maxint +if int(long(x)) != x: raise TestFailed, 'long op' +try: int(long(x)+1L) +except OverflowError: pass +else:raise TestFailed, 'long op' +x = -x +if int(long(x)) != x: raise TestFailed, 'long op' +x = x-1 +if int(long(x)) != x: raise TestFailed, 'long op' +try: int(long(x)-1L) +except OverflowError: pass +else:raise TestFailed, 'long op' print '6.4.3 Floating point numbers' if 12.0 + 24.0 <> 36.0: raise TestFailed, 'float op' if 12.0 + (-24.0) <> -12.0: raise TestFailed, 'float op' |