From c7aa9cb24de431c73ddb5a5fa024a0e68c0eb3c9 Mon Sep 17 00:00:00 2001 From: Michele Simionato Date: Sun, 15 Apr 2018 12:09:32 +0200 Subject: Fixed decorator factories with positional arguments --- src/tests/documentation.py | 8 ++++---- src/tests/test.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/tests') diff --git a/src/tests/documentation.py b/src/tests/documentation.py index 3a013dc..2588768 100644 --- a/src/tests/documentation.py +++ b/src/tests/documentation.py @@ -412,7 +412,7 @@ available. For instance: .. code-block:: python - >>> @blocking(msg="Please wait ...") + >>> @blocking("Please wait ...") ... def read_data(): ... time.sleep(3) # simulate a blocking resource ... return "some data" @@ -1524,15 +1524,15 @@ class Action(object): ... PermissionError: User does not have the permission to run insert! """ - @restricted(user_class=User) + @restricted(User) def view(self): pass - @restricted(user_class=PowerUser) + @restricted(PowerUser) def insert(self): pass - @restricted(user_class=Admin) + @restricted(Admin) def delete(self): pass diff --git a/src/tests/test.py b/src/tests/test.py index cd99e95..b42d062 100644 --- a/src/tests/test.py +++ b/src/tests/test.py @@ -134,8 +134,8 @@ class ExtraTestCase(unittest.TestCase): def f(x): return x - self.assertEqual(add(f)(0), 1) - self.assertEqual(add(f, 2)(0), 2) + self.assertEqual(add(2, f)(0), 2) + # ################### test dispatch_on ############################# # # adapted from test_functools in Python 3.5 -- cgit v1.2.1