diff options
| author | Ezio Melotti <ezio.melotti@gmail.com> | 2010-08-02 23:34:49 (GMT) |
|---|---|---|
| committer | Ezio Melotti <ezio.melotti@gmail.com> | 2010-08-02 23:34:49 (GMT) |
| commit | 1d55ec329a08c2d022d4d83887bd71755bc52026 (patch) | |
| tree | 01731ecfcdb5a5be08ff566febb4de0cc047636a /Lib/test/test_coercion.py | |
| parent | cc436eb6e83f231c4d5c1bfdd8565b6b4b45effa (diff) | |
| download | cpython-1d55ec329a08c2d022d4d83887bd71755bc52026.zip cpython-1d55ec329a08c2d022d4d83887bd71755bc52026.tar.gz cpython-1d55ec329a08c2d022d4d83887bd71755bc52026.tar.bz2 | |
Merged revisions 79539 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r79539 | florent.xicluna | 2010-04-01 01:01:03 +0300 (Thu, 01 Apr 2010) | 2 lines
Replace catch_warnings with check_warnings when it makes sense. Use assertRaises context manager to simplify some tests.
........
Diffstat (limited to 'Lib/test/test_coercion.py')
| -rw-r--r-- | Lib/test/test_coercion.py | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/Lib/test/test_coercion.py b/Lib/test/test_coercion.py index a36c041..23816b5 100644 --- a/Lib/test/test_coercion.py +++ b/Lib/test/test_coercion.py @@ -1,7 +1,6 @@ import copy -import warnings import unittest -from test.test_support import run_unittest, TestFailed +from test.test_support import run_unittest, TestFailed, check_warnings # Fake a number that implements numeric methods through __coerce__ class CoerceNumber: @@ -223,12 +222,6 @@ def process_infix_results(): infix_results[key] = res -with warnings.catch_warnings(): - warnings.filterwarnings("ignore", "classic int division", - DeprecationWarning) - process_infix_results() -# now infix_results has two lists of results for every pairing. - prefix_binops = [ 'divmod' ] prefix_results = [ [(1,0), (1L,0L), (0.0,2.0), ((1+0j),0j), TE, TE, TE, TE, (1,0)], @@ -339,11 +332,13 @@ class CoercionTest(unittest.TestCase): raise exc def test_main(): - with warnings.catch_warnings(): - warnings.filterwarnings("ignore", "complex divmod.., // and % " - "are deprecated", DeprecationWarning) - warnings.filterwarnings("ignore", "classic (int|long) division", - DeprecationWarning) + with check_warnings(("complex divmod.., // and % are deprecated", + DeprecationWarning), + ("classic (int|long) division", DeprecationWarning), + quiet=True): + process_infix_results() + # now infix_results has two lists of results for every pairing. + run_unittest(CoercionTest) if __name__ == "__main__": |
