diff options
author | Michele Simionato <michele.simionato@gmail.com> | 2018-01-14 12:54:18 +0100 |
---|---|---|
committer | Michele Simionato <michele.simionato@gmail.com> | 2018-01-14 12:54:18 +0100 |
commit | 3601bbc4bd5092336038227a80dbdc00640dfa5c (patch) | |
tree | 49255e25a8c8fa14ebbf19141e49f5de315a0cff | |
parent | 723c5cec2e2be34d033d0c7ace7654480f5607ff (diff) | |
download | python-decorator-git-3601bbc4bd5092336038227a80dbdc00640dfa5c.tar.gz |
Added a test_add1
-rw-r--r-- | CHANGES.md | 2 | ||||
-rw-r--r-- | src/tests/test.py | 11 |
2 files changed, 12 insertions, 1 deletions
@@ -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') |