summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2015-05-03 15:29:58 (GMT)
committerBenjamin Peterson <benjamin@python.org>2015-05-03 15:29:58 (GMT)
commit63a6a6fd41da648c9e79a2e347c151e1957d74e9 (patch)
tree2995339e45c2cac9f6c843b8d1be4fb37ee6cd2e /Lib
parent4b7b82f1334ae9e860ff84979699875a833f968f (diff)
parent8c59816b70a30d8ec2ff4e60a8b4a747f8ff75db (diff)
downloadcpython-63a6a6fd41da648c9e79a2e347c151e1957d74e9.zip
cpython-63a6a6fd41da648c9e79a2e347c151e1957d74e9.tar.gz
cpython-63a6a6fd41da648c9e79a2e347c151e1957d74e9.tar.bz2
merge 3.4 (#24096)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_warnings.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_warnings.py b/Lib/test/test_warnings.py
index 303ca71..bda1046 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