diff options
| author | Michele Simionato <michele.simionato@gmail.com> | 2018-08-04 07:11:33 +0200 |
|---|---|---|
| committer | Michele Simionato <michele.simionato@gmail.com> | 2018-08-04 07:11:33 +0200 |
| commit | a40a84f46938fc7ff3dc4a449d862690efb690d2 (patch) | |
| tree | 5a02d6cb7dddd6361d611fb348c7e97d56ea1b46 /src/tests/test.py | |
| parent | eb890d98739196b83f1ecb5cb7bcfe9739a9502c (diff) | |
| download | python-decorator-git-a40a84f46938fc7ff3dc4a449d862690efb690d2.tar.gz | |
Support for Python 3.7
Diffstat (limited to 'src/tests/test.py')
| -rw-r--r-- | src/tests/test.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/tests/test.py b/src/tests/test.py index b42d062..6d4d210 100644 --- a/src/tests/test.py +++ b/src/tests/test.py @@ -6,10 +6,15 @@ import decimal import inspect import functools import collections +from collections import defaultdict +try: + c = collections.abc +except AttributeError: + c = collections from decorator import dispatch_on, contextmanager, decorator try: from . import documentation as doc -except: +except ImportError: import documentation as doc @@ -23,6 +28,7 @@ def assertRaises(etype): else: raise Exception('Expected %s' % etype.__name__) + if sys.version >= '3.5': exec('''from asyncio import get_event_loop @@ -237,7 +243,6 @@ class TestSingleDispatch(unittest.TestCase): self.assertEqual(g(rnd), ("Number got rounded",)) def test_register_abc(self): - c = collections d = {"a": "b"} l = [1, 2, 3] s = set([object(), None]) @@ -348,8 +353,6 @@ class TestSingleDispatch(unittest.TestCase): self.assertEqual(g(t), "tuple") def test_mro_conflicts(self): - c = collections - @singledispatch def g(obj): return "base" @@ -410,9 +413,9 @@ class TestSingleDispatch(unittest.TestCase): # MutableMapping's bases implicit as well from defaultdict's # perspective. with assertRaises(RuntimeError): - self.assertEqual(h(c.defaultdict(lambda: 0)), "sized") + self.assertEqual(h(defaultdict(lambda: 0)), "sized") - class R(c.defaultdict): + class R(defaultdict): pass c.MutableSequence.register(R) |
