mirror of
https://github.com/python/cpython.git
synced 2024-11-25 02:44:06 +08:00
Fixed a typo and added more tests.
This commit is contained in:
parent
e2a600099d
commit
bc1c7a0854
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user