diff options
author | Benjamin Peterson <benjamin@python.org> | 2015-05-03 15:28:46 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2015-05-03 15:28:46 (GMT) |
commit | 8c59816b70a30d8ec2ff4e60a8b4a747f8ff75db (patch) | |
tree | c09195c80d4594c6261c072ca9dda43b2201f469 /Lib/test/test_warnings.py | |
parent | b9c04db64fd0315a30c4360d7ad33b975d5fbfc1 (diff) | |
parent | deff2b76ec3824ff238ad0812c29aca95534ecb4 (diff) | |
download | cpython-8c59816b70a30d8ec2ff4e60a8b4a747f8ff75db.zip cpython-8c59816b70a30d8ec2ff4e60a8b4a747f8ff75db.tar.gz cpython-8c59816b70a30d8ec2ff4e60a8b4a747f8ff75db.tar.bz2 |
merge 3.3 (#24096)
Diffstat (limited to 'Lib/test/test_warnings.py')
-rw-r--r-- | Lib/test/test_warnings.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_warnings.py b/Lib/test/test_warnings.py index fb01b83..ddcea8e 100644 --- a/Lib/test/test_warnings.py +++ b/Lib/test/test_warnings.py @@ -247,6 +247,18 @@ class FilterTests(BaseTest): self.assertEqual(str(w[-1].message), text) self.assertTrue(w[-1].category is UserWarning) + def test_mutate_filter_list(self): + class X: + def match(self, a): + L[:] = [] + + L = [("default",X(),UserWarning,X(),0) for i in range(2)] + with original_warnings.catch_warnings(record=True, + module=self.module) as w: + self.module.filters = L + self.module.warn_explicit(UserWarning("b"), None, "f.py", 42) + self.assertEqual(str(w[-1].message), "b") + class CFilterTests(FilterTests, unittest.TestCase): module = c_warnings |