summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_decimal.py
diff options
context:
space:
mode:
authorBrandt Bucher <brandt@python.org>2022-01-16 16:06:37 (GMT)
committerGitHub <noreply@github.com>2022-01-16 16:06:37 (GMT)
commit5cd9a162cd02a3d0f1b0a182d80feeb17439e84f (patch)
tree3a80de2f3551e23f85f4c63200e5ecd844dfa374 /Lib/test/test_decimal.py
parent09087b8519316608b85131ee7455b664c00c38d2 (diff)
downloadcpython-5cd9a162cd02a3d0f1b0a182d80feeb17439e84f.zip
cpython-5cd9a162cd02a3d0f1b0a182d80feeb17439e84f.tar.gz
cpython-5cd9a162cd02a3d0f1b0a182d80feeb17439e84f.tar.bz2
bpo-46361: Fix "small" `int` caching (GH-30583)
Diffstat (limited to 'Lib/test/test_decimal.py')
-rw-r--r--Lib/test/test_decimal.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py
index b6173a5..9ced801 100644
--- a/Lib/test/test_decimal.py
+++ b/Lib/test/test_decimal.py
@@ -2552,6 +2552,13 @@ class PythonAPItests(unittest.TestCase):
self.assertRaises(OverflowError, int, Decimal('inf'))
self.assertRaises(OverflowError, int, Decimal('-inf'))
+ @cpython_only
+ def test_small_ints(self):
+ Decimal = self.decimal.Decimal
+ # bpo-46361
+ for x in range(-5, 257):
+ self.assertIs(int(Decimal(x)), x)
+
def test_trunc(self):
Decimal = self.decimal.Decimal