summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichele Simionato <michele.simionato@gmail.com>2018-01-14 12:54:18 +0100
committerMichele Simionato <michele.simionato@gmail.com>2018-01-14 12:54:18 +0100
commit3601bbc4bd5092336038227a80dbdc00640dfa5c (patch)
tree49255e25a8c8fa14ebbf19141e49f5de315a0cff
parent723c5cec2e2be34d033d0c7ace7654480f5607ff (diff)
downloadpython-decorator-git-3601bbc4bd5092336038227a80dbdc00640dfa5c.tar.gz
Added a test_add1
-rw-r--r--CHANGES.md2
-rw-r--r--src/tests/test.py11
2 files changed, 12 insertions, 1 deletions
diff --git a/CHANGES.md b/CHANGES.md
index 3e9bd3f..cbf5be8 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -5,7 +5,7 @@ HISTORY
## 4.2.1 (2018-01-14)
-Fixed a regression breaking IPython and discovered by https://github.com/spapini
+Fixed a regression breaking IPython reported by https://github.com/spapini .
## 4.2.0 (2018-01-14)
diff --git a/src/tests/test.py b/src/tests/test.py
index e5f2ff4..cd99e95 100644
--- a/src/tests/test.py
+++ b/src/tests/test.py
@@ -126,6 +126,17 @@ class ExtraTestCase(unittest.TestCase):
return method(app)
catch_config_error(lambda app: None)
+ def test_add1(self):
+ # similar to what IPython is doing in traitlets.config.application
+ @decorator
+ def add(func, const=1, *args, **kwargs):
+ return const + func(*args, **kwargs)
+
+ def f(x):
+ return x
+ self.assertEqual(add(f)(0), 1)
+ self.assertEqual(add(f, 2)(0), 2)
+
# ################### test dispatch_on ############################# #
# adapted from test_functools in Python 3.5
singledispatch = dispatch_on('obj')