summaryrefslogtreecommitdiff
path: root/coverage/misc.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2018-09-09 13:30:08 -0400
committerNed Batchelder <ned@nedbatchelder.com>2018-09-09 13:30:08 -0400
commit42c0c58c452f6f10b26986cefe9cd00688081546 (patch)
treedbe625f88840cc0fe8ed7f927e37868b509dc705 /coverage/misc.py
parentc6b688ac89dca7e8ab5d03ead7799c33f8a92785 (diff)
downloadpython-coveragepy-git-42c0c58c452f6f10b26986cefe9cd00688081546.tar.gz
Name decorator components to avoid docstring requirement
Diffstat (limited to 'coverage/misc.py')
-rw-r--r--coverage/misc.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/coverage/misc.py b/coverage/misc.py
index 7b8fbb93..a923829d 100644
--- a/coverage/misc.py
+++ b/coverage/misc.py
@@ -70,11 +70,11 @@ if env.TESTING:
"""Ensure that only one of the argnames is non-None."""
def _decorator(func):
argnameset = set(name.strip() for name in argnames.split(","))
- def _wrapped(*args, **kwargs):
+ def _wrapper(*args, **kwargs):
vals = [kwargs.get(name) for name in argnameset]
assert sum(val is not None for val in vals) == 1
return func(*args, **kwargs)
- return _wrapped
+ return _wrapper
return _decorator
else: # pragma: not testing
# We aren't using real PyContracts, so just define our decorators as
@@ -149,13 +149,12 @@ def expensive(fn):
if env.TESTING:
attr = "_once_" + fn.__name__
- def _wrapped(self):
- """Inner function that checks the cache."""
+ def _wrapper(self):
if hasattr(self, attr):
raise AssertionError("Shouldn't have called %s more than once" % fn.__name__)
setattr(self, attr, True)
return fn(self)
- return _wrapped
+ return _wrapper
else:
return fn # pragma: not testing