Skip to content

Commit abc1638

Browse files
committed
Add more tests
1 parent 0fd098f commit abc1638

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

Lib/test/test_sys.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,9 +702,25 @@ def test_attributes(self):
702702
absent = object()
703703
with self.assertWarnsRegex(
704704
DeprecationWarning,
705-
r'sys\.abiflags will be set.*on all platforms',
705+
r'sys\.abiflags will be set\b.*\bon all platforms',
706706
):
707707
self.assertIs(getattr(sys, 'abiflags', absent), absent)
708+
with self.assertWarnsRegex(
709+
DeprecationWarning,
710+
r'sys\.abiflags will be set\b.*\bon all platforms',
711+
):
712+
self.assertFalse(hasattr(sys, 'abiflags'))
713+
714+
# Emit a deprecated warning and also raise an AttributeError
715+
with self.assertRaisesRegex(
716+
AttributeError,
717+
r"module 'sys' has no attribute 'abiflags'",
718+
):
719+
with self.assertWarnsRegex(
720+
DeprecationWarning,
721+
r'sys\.abiflags will be set\b.*\bon all platforms',
722+
):
723+
_ = sys.abiflags
708724

709725
def test_thread_info(self):
710726
info = sys.thread_info

0 commit comments

Comments
 (0)