~ubuntu-branches/ubuntu/oneiric/python2.6/oneiric

« back to all changes in this revision

Viewing changes to Lib/test/test_descr.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2010-08-07 20:03:08 UTC
  • mfrom: (10.1.27 sid)
  • Revision ID: james.westby@ubuntu.com-20100807200308-bwsyymoc4donr9a9
Tags: 2.6.6~rc1-1ubuntu1
* Merge with Debian; remaining changes:
  - Regenerate the control file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
import __builtin__
 
2
import sys
2
3
import types
3
4
import unittest
4
 
import warnings
5
5
 
6
6
from copy import deepcopy
7
7
from test import test_support
58
58
                expr = '%s a' % expr
59
59
            self.unops[name] = expr
60
60
 
61
 
    def setUp(self):
62
 
        self.original_filters = warnings.filters[:]
63
 
        warnings.filterwarnings("ignore",
64
 
                 r'complex divmod\(\), // and % are deprecated$',
65
 
                 DeprecationWarning, r'(<string>|%s)$' % __name__)
66
 
 
67
 
    def tearDown(self):
68
 
        warnings.filters = self.original_filters
69
 
 
70
61
    def unop_test(self, a, res, expr="len(a)", meth="__len__"):
71
62
        d = {'a': a}
72
63
        self.assertEqual(eval(expr, d), res)
4433
4424
 
4434
4425
 
4435
4426
def test_main():
4436
 
    # Run all local test cases, with PTypesLongInitTest first.
4437
 
    test_support.run_unittest(PTypesLongInitTest, OperatorsTest,
4438
 
                              ClassPropertiesAndMethods, DictProxyTests)
 
4427
    deprecations = [(r'complex divmod\(\), // and % are deprecated$',
 
4428
                     DeprecationWarning)]
 
4429
    if sys.py3kwarning:
 
4430
        deprecations += [
 
4431
            ("classic (int|long) division", DeprecationWarning),
 
4432
            ("coerce.. not supported", DeprecationWarning),
 
4433
            (".+__(get|set|del)slice__ has been removed", DeprecationWarning)]
 
4434
    with test_support.check_warnings(*deprecations):
 
4435
        # Run all local test cases, with PTypesLongInitTest first.
 
4436
        test_support.run_unittest(PTypesLongInitTest, OperatorsTest,
 
4437
                                  ClassPropertiesAndMethods, DictProxyTests)
4439
4438
 
4440
4439
if __name__ == "__main__":
4441
4440
    test_main()