diff options
author | Benjamin Peterson <benjamin@python.org> | 2008-05-06 22:18:11 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2008-05-06 22:18:11 (GMT) |
commit | d29503291013b7dfd70522e776b0c244aff0a264 (patch) | |
tree | 4bcf1eea33328c03196b89d82fdaa47b8761dc99 /Lib | |
parent | c730d5f7e5a6f83b7ac71bc2393d2c848b95f30b (diff) | |
download | cpython-d29503291013b7dfd70522e776b0c244aff0a264.zip cpython-d29503291013b7dfd70522e776b0c244aff0a264.tar.gz cpython-d29503291013b7dfd70522e776b0c244aff0a264.tar.bz2 |
Fix logic error in Python/_warnings.c and add a test to verify
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_warnings.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_warnings.py b/Lib/test/test_warnings.py index 1b5ee32..70d8c56 100644 --- a/Lib/test/test_warnings.py +++ b/Lib/test/test_warnings.py @@ -388,6 +388,15 @@ class _WarningsTests(BaseTest): result = stream.getvalue() self.failUnless(text in result) + def test_showwarning_not_callable(self): + self.module.filterwarnings("always", category=UserWarning) + old_showwarning = self.module.showwarning + self.module.showwarning = 23 + try: + self.assertRaises(TypeError, self.module.warn, "Warning!") + finally: + self.module.showwarning = old_showwarning + def test_show_warning_output(self): # With showarning() missing, make sure that output is okay. text = 'test show_warning' |