diff options
author | Florent Xicluna <florent.xicluna@gmail.com> | 2010-03-31 22:01:03 (GMT) |
---|---|---|
committer | Florent Xicluna <florent.xicluna@gmail.com> | 2010-03-31 22:01:03 (GMT) |
commit | 6257a7bbb2660ae75c44f2e71d7ac2ce73900f74 (patch) | |
tree | 6f010065c95f2d5617f56e07ba2628be21cf9d7a /Lib/test/test_descr.py | |
parent | ad5983364966b49c277b495112ae41c6ae2d01ed (diff) | |
download | cpython-6257a7bbb2660ae75c44f2e71d7ac2ce73900f74.zip cpython-6257a7bbb2660ae75c44f2e71d7ac2ce73900f74.tar.gz cpython-6257a7bbb2660ae75c44f2e71d7ac2ce73900f74.tar.bz2 |
Replace catch_warnings with check_warnings when it makes sense. Use assertRaises context manager to simplify some tests.
Diffstat (limited to 'Lib/test/test_descr.py')
-rw-r--r-- | Lib/test/test_descr.py | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index bff88bc..d450eed 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -2,7 +2,6 @@ import __builtin__ import sys import types import unittest -import warnings from copy import deepcopy from test import test_support @@ -59,15 +58,6 @@ class OperatorsTest(unittest.TestCase): expr = '%s a' % expr self.unops[name] = expr - def setUp(self): - self.original_filters = warnings.filters[:] - warnings.filterwarnings("ignore", - r'complex divmod\(\), // and % are deprecated$', - DeprecationWarning, r'(<string>|%s)$' % __name__) - - def tearDown(self): - warnings.filters = self.original_filters - def unop_test(self, a, res, expr="len(a)", meth="__len__"): d = {'a': a} self.assertEqual(eval(expr, d), res) @@ -4622,11 +4612,15 @@ class PTypesLongInitTest(unittest.TestCase): def test_main(): - with test_support.check_py3k_warnings( + deprecations = [(r'complex divmod\(\), // and % are deprecated$', + DeprecationWarning)] + if sys.py3kwarning: + deprecations += [ ("classic (int|long) division", DeprecationWarning), ("coerce.. not supported", DeprecationWarning), ("Overriding __cmp__ ", DeprecationWarning), - (".+__(get|set|del)slice__ has been removed", DeprecationWarning)): + (".+__(get|set|del)slice__ has been removed", DeprecationWarning)] + with test_support.check_warnings(*deprecations): # Run all local test cases, with PTypesLongInitTest first. test_support.run_unittest(PTypesLongInitTest, OperatorsTest, ClassPropertiesAndMethods, DictProxyTests) |