mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-17 01:51:39 +09:00
56 lines
905 B
Python
56 lines
905 B
Python
try:
|
|
5 / 0
|
|
except ZeroDivisionError:
|
|
pass
|
|
else:
|
|
assert False, 'Expected ZeroDivisionError'
|
|
|
|
try:
|
|
5 / -0.0
|
|
except ZeroDivisionError:
|
|
pass
|
|
else:
|
|
assert False, 'Expected ZeroDivisionError'
|
|
|
|
try:
|
|
5 / (2-2)
|
|
except ZeroDivisionError:
|
|
pass
|
|
else:
|
|
assert False, 'Expected ZeroDivisionError'
|
|
|
|
try:
|
|
5 % 0
|
|
except ZeroDivisionError:
|
|
pass
|
|
else:
|
|
assert False, 'Expected ZeroDivisionError'
|
|
|
|
try:
|
|
5 // 0
|
|
except ZeroDivisionError:
|
|
pass
|
|
else:
|
|
assert False, 'Expected ZeroDivisionError'
|
|
|
|
try:
|
|
5.3 // (-0.0)
|
|
except ZeroDivisionError:
|
|
pass
|
|
else:
|
|
assert False, 'Expected ZeroDivisionError'
|
|
|
|
try:
|
|
divmod(5, 0)
|
|
except ZeroDivisionError:
|
|
pass
|
|
else:
|
|
assert False, 'Expected ZeroDivisionError'
|
|
|
|
try:
|
|
raise ZeroDivisionError('Is an ArithmeticError subclass?')
|
|
except ArithmeticError:
|
|
pass
|
|
else:
|
|
assert False, 'Expected ZeroDivisionError'
|