Skip to content

Commit 3222054

Browse files
GH-102341: Improve the test function for pow (#102342)
Co-authored-by: Terry Jan Reedy <[email protected]>
1 parent 7894bbe commit 3222054

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Lib/test/test_pow.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,11 @@ def powtest(self, type):
1919
self.assertEqual(pow(2, i), pow2)
2020
if i != 30 : pow2 = pow2*2
2121

22-
for othertype in (int,):
23-
for i in list(range(-10, 0)) + list(range(1, 10)):
24-
ii = type(i)
25-
for j in range(1, 11):
26-
jj = -othertype(j)
27-
pow(ii, jj)
22+
for i in list(range(-10, 0)) + list(range(1, 10)):
23+
ii = type(i)
24+
inv = pow(ii, -1) # inverse of ii
25+
for jj in range(-10, 0):
26+
self.assertAlmostEqual(pow(ii, jj), pow(inv, -jj))
2827

2928
for othertype in int, float:
3029
for i in range(1, 100):

0 commit comments

Comments
 (0)