diff options
Diffstat (limited to 'src/tests')
| -rw-r--r-- | src/tests/documentation.py | 8 | ||||
| -rw-r--r-- | src/tests/test.py | 3 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/tests/documentation.py b/src/tests/documentation.py index 69e9f4b..81409fc 100644 --- a/src/tests/documentation.py +++ b/src/tests/documentation.py @@ -1016,10 +1016,10 @@ David Goldstein and here is an example where it is manifest: >>> @memoize ... def getkeys(**kw): ... return kw.keys() - >>> getkeys(func='a') + >>> getkeys(func='a') # doctest: +ELLIPSIS Traceback (most recent call last): ... - TypeError: _memoize() got multiple values for argument 'func' + TypeError: _memoize() got multiple values for ... 'func' The error message looks really strange until you realize that the caller function `_memoize` uses `func` as first argument, @@ -1043,8 +1043,8 @@ follows: return cache[key] We have avoided the need to name the first argument, so the problem -simply disappear. This is a technique that you should keep in mind -when writing decorator for functions with keyword arguments. +simply disappears. This is a technique that you should keep in mind +when writing decorators for functions with keyword arguments. On a similar tone, there is a restriction on the names of the arguments: for instance, if try to call an argument ``_call_`` or diff --git a/src/tests/test.py b/src/tests/test.py index b01bc10..5bd34e8 100644 --- a/src/tests/test.py +++ b/src/tests/test.py @@ -89,7 +89,8 @@ class ExtraTestCase(unittest.TestCase): def func(**kw): return kw - self.assertEqual(func(f='a'), {'f': 'a'}) + # there is no confusion when passing args as a keyword argument + self.assertEqual(func(args='a'), {'args': 'a'}) # ################### test dispatch_on ############################# # # adapted from test_functools in Python 3.5 |
