summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichele Simionato <michele.simionato@gmail.com>2021-03-31 10:12:24 +0200
committerGitHub <noreply@github.com>2021-03-31 10:12:24 +0200
commitf3ed7629e2dea7d8dea01f210ae6620e0005b79d (patch)
treeb698ecb2446c5503795d84df98d888b8a5dca814
parent3c95a87376c9278834af918a1785bf790b15202b (diff)
parent226404a31834d2eb50bf4c3c941ecc89eb38cbe7 (diff)
downloadpython-decorator-git-f3ed7629e2dea7d8dea01f210ae6620e0005b79d.tar.gz
Merge pull request #98 from micheles/cleanup
Removed more legacy code
-rw-r--r--src/tests/test.py26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/tests/test.py b/src/tests/test.py
index acca5fb..4743c23 100644
--- a/src/tests/test.py
+++ b/src/tests/test.py
@@ -3,9 +3,8 @@ import doctest
import unittest
import decimal
import inspect
-import functools
from asyncio import get_event_loop
-from collections import defaultdict, abc as c
+from collections import defaultdict, ChainMap, abc as c
from decorator import dispatch_on, contextmanager, decorator
import documentation as doc
@@ -71,13 +70,11 @@ class DocumentationTestCase(unittest.TestCase):
self.assertEqual(err, 0)
def test_singledispatch1(self):
- if hasattr(functools, 'singledispatch'):
- with assertRaises(RuntimeError):
- doc.singledispatch_example1()
+ with assertRaises(RuntimeError):
+ doc.singledispatch_example1()
def test_singledispatch2(self):
- if hasattr(functools, 'singledispatch'):
- doc.singledispatch_example2()
+ doc.singledispatch_example2()
def test_context_manager(self):
@@ -293,14 +290,13 @@ class TestSingleDispatch(unittest.TestCase):
self.assertEqual(g(f), "sized")
self.assertEqual(g(t), "sized")
- if hasattr(c, 'ChainMap'):
- g.register(c.ChainMap)(lambda obj: "chainmap")
- # irrelevant ABCs registered
- self.assertEqual(g(d), "mutablemapping")
- self.assertEqual(g(l), "sized")
- self.assertEqual(g(s), "sized")
- self.assertEqual(g(f), "sized")
- self.assertEqual(g(t), "sized")
+ g.register(ChainMap)(lambda obj: "chainmap")
+ # irrelevant ABCs registered
+ self.assertEqual(g(d), "mutablemapping")
+ self.assertEqual(g(l), "sized")
+ self.assertEqual(g(s), "sized")
+ self.assertEqual(g(f), "sized")
+ self.assertEqual(g(t), "sized")
g.register(c.MutableSequence)(lambda obj: "mutablesequence")
self.assertEqual(g(d), "mutablemapping")