summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_warnings.py
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2008-05-06 23:45:46 (GMT)
committerChristian Heimes <christian@cheimes.de>2008-05-06 23:45:46 (GMT)
commit8dc226fccd2183670ac19a85b89941f5b05167dc (patch)
treea02b3f53c54d1e18139d53de40954828350fabcb /Lib/test/test_warnings.py
parent1bf7108fd515af1b537dcbf738c3cb488af5ab0d (diff)
downloadcpython-8dc226fccd2183670ac19a85b89941f5b05167dc.zip
cpython-8dc226fccd2183670ac19a85b89941f5b05167dc.tar.gz
cpython-8dc226fccd2183670ac19a85b89941f5b05167dc.tar.bz2
Merged revisions 62774-62775,62785,62787-62788 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r62774 | georg.brandl | 2008-05-06 19:11:42 +0200 (Tue, 06 May 2008) | 2 lines #2773: fix description of 'g' and 'G' formatting spec. ........ r62775 | georg.brandl | 2008-05-06 19:20:54 +0200 (Tue, 06 May 2008) | 2 lines > != (!<). ........ r62785 | benjamin.peterson | 2008-05-07 00:18:11 +0200 (Wed, 07 May 2008) | 2 lines Fix logic error in Python/_warnings.c and add a test to verify ........ r62787 | benjamin.peterson | 2008-05-07 00:31:52 +0200 (Wed, 07 May 2008) | 2 lines Make the Python implementation of warnings compatible with the C implementation regarding non-callable showwarning ........ r62788 | christian.heimes | 2008-05-07 00:41:46 +0200 (Wed, 07 May 2008) | 1 line Implemented PEP 370 ........
Diffstat (limited to 'Lib/test/test_warnings.py')
-rw-r--r--Lib/test/test_warnings.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_warnings.py b/Lib/test/test_warnings.py
index 945dbb3..fa2297c 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'