Issue #7849: Now the utility `check_warnings` verifies if the warnings are

effectively raised.  A new utility ``check_py3k_warnings`` deals with py3k warnings.
This commit is contained in:
Florent Xicluna 2010-03-07 12:18:33 +00:00
parent 1f3b4e12e8
commit 6de9e938a5
8 changed files with 102 additions and 27 deletions

View file

@ -17,14 +17,11 @@ class FormatDeprecationTests(unittest.TestCase):
PyOS_ascii_formatd = pythonapi.PyOS_ascii_formatd
buf = create_string_buffer(' ' * 100)
with check_warnings() as w:
warnings.simplefilter('default')
with check_warnings():
PyOS_ascii_formatd(byref(buf), sizeof(buf), '%+.10f',
c_double(10.0))
self.assertEqual(buf.value, '+10.0000000000')
self.assertEqual(w.category, DeprecationWarning)
class FormatTests(unittest.TestCase):
# ensure that, for the restricted set of format codes,
# %-formatting returns the same values os PyOS_ascii_formatd