From 3bb233dc44ef7eaa31809b12607ba9b2672fe7e0 Mon Sep 17 00:00:00 2001 From: "Partha P. Mukherjee" Date: Tue, 28 Feb 2023 16:26:23 -0500 Subject: [PATCH 1/5] GH-102341: Improve the test function for pow --- Lib/test/test_pow.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_pow.py b/Lib/test/test_pow.py index 5cea9ceb20f5cc..ca7872a82513b3 100644 --- a/Lib/test/test_pow.py +++ b/Lib/test/test_pow.py @@ -22,9 +22,10 @@ def powtest(self, type): for othertype in (int,): for i in list(range(-10, 0)) + list(range(1, 10)): ii = type(i) + inv = pow(ii, -1) # inverse of ii for j in range(1, 11): jj = -othertype(j) - pow(ii, jj) + self.assertAlmostEqual(pow(ii, jj), pow(inv, -jj)) for othertype in int, float: for i in range(1, 100): From a47be96d10e048c802091a9783bce2e747bc10b1 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Sat, 4 Mar 2023 13:16:34 -0500 Subject: [PATCH 2/5] Update Lib/test/test_pow.py --- Lib/test/test_pow.py | 1 - 1 file changed, 1 deletion(-) diff --git a/Lib/test/test_pow.py b/Lib/test/test_pow.py index ca7872a82513b3..da8d917b9e7f09 100644 --- a/Lib/test/test_pow.py +++ b/Lib/test/test_pow.py @@ -19,7 +19,6 @@ def powtest(self, type): self.assertEqual(pow(2, i), pow2) if i != 30 : pow2 = pow2*2 - for othertype in (int,): for i in list(range(-10, 0)) + list(range(1, 10)): ii = type(i) inv = pow(ii, -1) # inverse of ii From b227f20c0caeae74a2861beaba6b325acf0bc746 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Sat, 4 Mar 2023 13:16:44 -0500 Subject: [PATCH 3/5] Update Lib/test/test_pow.py --- Lib/test/test_pow.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_pow.py b/Lib/test/test_pow.py index da8d917b9e7f09..08fa37ea6eb8fe 100644 --- a/Lib/test/test_pow.py +++ b/Lib/test/test_pow.py @@ -19,9 +19,9 @@ def powtest(self, type): self.assertEqual(pow(2, i), pow2) if i != 30 : pow2 = pow2*2 - for i in list(range(-10, 0)) + list(range(1, 10)): - ii = type(i) - inv = pow(ii, -1) # inverse of ii + for i in list(range(-10, 0)) + list(range(1, 10)): + ii = type(i) + inv = pow(ii, -1) # inverse of ii for j in range(1, 11): jj = -othertype(j) self.assertAlmostEqual(pow(ii, jj), pow(inv, -jj)) From da9e41185be791f6a9153d8a5a00db54affea776 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Sat, 4 Mar 2023 13:16:50 -0500 Subject: [PATCH 4/5] Update Lib/test/test_pow.py --- Lib/test/test_pow.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_pow.py b/Lib/test/test_pow.py index 08fa37ea6eb8fe..ef7f212d55a20c 100644 --- a/Lib/test/test_pow.py +++ b/Lib/test/test_pow.py @@ -22,8 +22,7 @@ def powtest(self, type): for i in list(range(-10, 0)) + list(range(1, 10)): ii = type(i) inv = pow(ii, -1) # inverse of ii - for j in range(1, 11): - jj = -othertype(j) + for jj in range(-10, 0): self.assertAlmostEqual(pow(ii, jj), pow(inv, -jj)) for othertype in int, float: From a24b63d1e999fe3787bef38a95bf603ec8a1dcde Mon Sep 17 00:00:00 2001 From: "Partha P. Mukherjee" Date: Sat, 4 Mar 2023 15:25:04 -0500 Subject: [PATCH 5/5] Fix indentation spaces --- Lib/test/test_pow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_pow.py b/Lib/test/test_pow.py index ef7f212d55a20c..eeb482ec4b27e2 100644 --- a/Lib/test/test_pow.py +++ b/Lib/test/test_pow.py @@ -23,7 +23,7 @@ def powtest(self, type): ii = type(i) inv = pow(ii, -1) # inverse of ii for jj in range(-10, 0): - self.assertAlmostEqual(pow(ii, jj), pow(inv, -jj)) + self.assertAlmostEqual(pow(ii, jj), pow(inv, -jj)) for othertype in int, float: for i in range(1, 100):