8000 GH-102341: Improve the test function for pow · python/cpython@3bb233d · GitHub
[go: up one dir, main page]

Skip to content

Commit 3bb233d

Browse files
committed
GH-102341: Improve the test function for pow
1 parent f300a1f commit 3bb233d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Lib/test/test_pow.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ def powtest(self, type):
2222
for othertype in (int,):
2323
for i in list(range(-10, 0)) + list(range(1, 10)):
2424
ii = type(i)
25+
inv = pow(ii, -1) # inverse of ii
2526
for j in range(1, 11):
2627
jj = -othertype(j)
27-
pow(ii, jj)
28+
self.assertAlmostEqual(pow(ii, jj), pow(inv, -jj))
2829

2930
for othertype in int, float:
3031
for i in range(1, 100):

0 commit comments

Comments
 (0)
0