Skip to content

Commit 4a6415c

Browse files
[3.12] gh-130230: Add new tests for 3-arg pow() with Decimal (GH-130237) (GH-130247)
(cherry picked from commit b93b7e5)
1 parent 0274115 commit 4a6415c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Lib/test/test_decimal.py

+9
Original file line numberDiff line numberDiff line change
@@ -4463,6 +4463,15 @@ def test_implicit_context(self):
44634463
self.assertIs(Decimal("NaN").fma(7, 1).is_nan(), True)
44644464
# three arg power
44654465
self.assertEqual(pow(Decimal(10), 2, 7), 2)
4466+
if self.decimal == C:
4467+
self.assertEqual(pow(10, Decimal(2), 7), 2)
4468+
self.assertEqual(pow(10, 2, Decimal(7)), 2)
4469+
else:
4470+
# XXX: Three-arg power doesn't use __rpow__.
4471+
self.assertRaises(TypeError, pow, 10, Decimal(2), 7)
4472+
# XXX: There is no special method to dispatch on the
4473+
# third arg of three-arg power.
4474+
self.assertRaises(TypeError, pow, 10, 2, Decimal(7))
44664475
# exp
44674476
self.assertEqual(Decimal("1.01").exp(), 3)
44684477
# is_normal

0 commit comments

Comments
 (0)