Skip to content

Commit 4bf2d14

Browse files
committed
gh-140036: Test modulo and divmod of pure Python Decimal in unbounded contexts
Check that `%` and `divmod()` stay fast when the context precision is `MAX_PREC`, as `//` already is.
1 parent e548b47 commit 4bf2d14

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎Lib/test/test_decimal.py‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4769,6 +4769,16 @@ def test_divide_unbound_context(self):
47694769
x = self.decimal.Decimal('1')
47704770
y = x // 1 # should be fast
47714771

4772+
def test_modulo_unbound_context(self):
4773+
with self.unbound_context() as c:
4774+
x = self.decimal.Decimal('1')
4775+
y = x % 1 # should be fast
4776+
4777+
def test_divmod_unbound_context(self):
4778+
with self.unbound_context() as c:
4779+
x = self.decimal.Decimal('1')
4780+
y = divmod(x, 1) # should be fast
4781+
47724782
def test_remainder_near(self):
47734783
L = 1000
47744784
limit = sys.get_int_max_str_digits()

0 commit comments

Comments
 (0)