Skip to content

Commit 7bbee0d

Browse files
committed
Assert the context var is unchanged and check the error message
1 parent 589b9f2 commit 7bbee0d

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

‎Lib/test/test_decimal.py‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3782,11 +3782,10 @@ def restore():
37823782
var.reset(token)
37833783

37843784
self.addCleanup(restore)
3785-
refcount = sys.getrefcount(value)
3786-
for _ in range(3):
3787-
with self.assertRaises(TypeError):
3788-
self.decimal.Decimal(1) + self.decimal.Decimal(2)
3789-
self.assertEqual(sys.getrefcount(value), refcount)
3785+
with self.assertRaisesRegex(TypeError, "got object"):
3786+
self.decimal.Decimal(1) + self.decimal.Decimal(2)
3787+
for var in context_vars:
3788+
self.assertIs(var.get(), value)
37903789

37913790
class PyContextAPItests(ContextAPItests, unittest.TestCase):
37923791
decimal = P

0 commit comments

Comments
 (0)