summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorMichele Simionato <michele.simionato@gmail.com>2021-05-15 06:08:54 +0200
committerMichele Simionato <michele.simionato@gmail.com>2021-05-15 06:08:54 +0200
commitdbb10360ec5e11126c6c3354038e1d41485c6323 (patch)
tree4e1c72ee9d035ce867333288f85d99014421b4da /src/tests
parente3c07ea54b6ea08765f01f72042debc66159d0a3 (diff)
downloadpython-decorator-git-dbb10360ec5e11126c6c3354038e1d41485c6323.tar.gz
Decorating builtin functions5.0.8
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/test.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/tests/test.py b/src/tests/test.py
index acdaf93..4531ce3 100644
--- a/src/tests/test.py
+++ b/src/tests/test.py
@@ -183,6 +183,17 @@ class ExtraTestCase(unittest.TestCase):
self.assertEqual(f(0, 1), [0, 1, None])
+ def test_slow_wrapper(self):
+ # see https://github.com/micheles/decorator/issues/123
+ dd = defaultdict(list)
+ doc.trace(defaultdict.__setitem__)(dd, 'x', [1])
+ self.assertEqual(dd['x'], [1])
+ # NB: defaultdict.__getitem__ has no signature and cannot be decorated
+ with self.assertRaises(ValueError):
+ doc.trace(defaultdict.__getitem__)
+ doc.trace(defaultdict.__delitem__)(dd, 'x')
+ self.assertEqual(dd['x'], [])
+
# ################### test dispatch_on ############################# #
# adapted from test_functools in Python 3.5