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_descr.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_descr.py')
| -rw-r--r-- | Lib/test/test_descr.py | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index 6d76214..55c5266 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -1,7 +1,7 @@ import __builtin__ +import sys import types import unittest -import warnings from copy import deepcopy from test import test_support @@ -58,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) @@ -4433,10 +4424,14 @@ 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), - (".+__(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) |
