From 3601bbc4bd5092336038227a80dbdc00640dfa5c Mon Sep 17 00:00:00 2001 From: Michele Simionato Date: Sun, 14 Jan 2018 12:54:18 +0100 Subject: Added a test_add1 --- src/tests/test.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src') 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') -- cgit v1.2.1