diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-09-04 06:33:00 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-09-04 06:33:00 (GMT) |
commit | bc1c7a085449302edcef3e7c2faae2433a020e39 (patch) | |
tree | a7cfcd4422059b3189c546bf7e49e07aded009e7 /Lib/test/test_long_future.py | |
parent | e2a600099d3b61327aba5be94d30d40773faa2c9 (diff) | |
download | cpython-bc1c7a085449302edcef3e7c2faae2433a020e39.zip cpython-bc1c7a085449302edcef3e7c2faae2433a020e39.tar.gz cpython-bc1c7a085449302edcef3e7c2faae2433a020e39.tar.bz2 |
Fixed a typo and added more tests.
Diffstat (limited to 'Lib/test/test_long_future.py')
-rw-r--r-- | Lib/test/test_long_future.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Lib/test/test_long_future.py b/Lib/test/test_long_future.py index 4348bbe..9321f70 100644 --- a/Lib/test/test_long_future.py +++ b/Lib/test/test_long_future.py @@ -17,14 +17,16 @@ def test_true_division(): verify(1 / huge == 0.0) verify(1L / huge == 0.0) verify(1 / mhuge == 0.0) - verify(1L / mhuge ==- 0.0) + verify(1L / mhuge == 0.0) verify((666 * huge + (huge >> 1)) / huge == 666.5) verify((666 * mhuge + (mhuge >> 1)) / mhuge == 666.5) verify((666 * huge + (huge >> 1)) / mhuge == -666.5) verify((666 * mhuge + (mhuge >> 1)) / huge == -666.5) verify(huge / (huge << 1) == 0.5) + verify((1000000 * huge) / huge == 1000000) namespace = {'huge': huge, 'mhuge': mhuge} + for overflow in ["float(huge)", "float(mhuge)", "huge / 1", "huge / 2L", "huge / -1", "huge / -2L", "mhuge / 100", "mhuge / 100L"]: @@ -35,4 +37,13 @@ def test_true_division(): else: raise TestFailed("expected OverflowError from %r" % overflow) + for zero in ["huge / 0", "huge / 0L", + "mhuge / 0", "mhuge / 0L"]: + try: + eval(zero, namespace) + except ZeroDivisionError: + pass + else: + raise TestFailed("expected ZeroDivisionError from %r" % zero) + test_true_division() |