Skip to content

Commit 8a39e18

Browse files
committed
tests/float: Add tests for zero to a negative power.
1 parent 3ed0e5e commit 8a39e18

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

tests/float/complex1.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
print((1j / 2j).real)
2929
print(1j / (1 + 2j))
3030
ans = 0j ** 0; print("%.5g %.5g" % (ans.real, ans.imag))
31+
ans = 0j ** 1; print("%.5g %.5g" % (ans.real, ans.imag))
3132
ans = 0j ** 0j; print("%.5g %.5g" % (ans.real, ans.imag))
3233
ans = 1j ** 2.5; print("%.5g %.5g" % (ans.real, ans.imag))
3334
ans = 1j ** 2.5j; print("%.5g %.5g" % (ans.real, ans.imag))
@@ -94,6 +95,10 @@
9495
print("ZeroDivisionError")
9596

9697
# zero division via power
98+
try:
99+
0j ** -1
100+
except ZeroDivisionError:
101+
print("ZeroDivisionError")
97102
try:
98103
0j ** 1j
99104
except ZeroDivisionError:

tests/float/float1.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@
7575
except ZeroDivisionError:
7676
print("ZeroDivisionError")
7777

78+
try:
79+
0.0 ** -1
80+
except ZeroDivisionError:
81+
print("ZeroDivisionError")
82+
7883
# unsupported unary ops
7984

8085
try:

tests/float/int_divzero.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,8 @@
22
1 / 0
33
except ZeroDivisionError:
44
print("ZeroDivisionError")
5+
6+
try:
7+
0 ** -1
8+
except ZeroDivisionError:
9+
print("ZeroDivisionError")

0 commit comments

Comments
 (0)