diff options
| author | stepshal <nessento@openmailbox.org> | 2016-10-08 17:36:47 +0700 |
|---|---|---|
| committer | stepshal <nessento@openmailbox.org> | 2016-10-08 17:36:47 +0700 |
| commit | bdf2692ca23347f1bdc54017b7f4e106dfa05b7f (patch) | |
| tree | be8560a4ee2c2f1a7fb9fffb9cf54fbad0db4ad2 /src | |
| parent | 79100259a2e8e133dcef761d13f4b5d3ba34429e (diff) | |
| download | python-decorator-git-bdf2692ca23347f1bdc54017b7f4e106dfa05b7f.tar.gz | |
Add blank lines after code object, class of function definition.
Diffstat (limited to 'src')
| -rw-r--r-- | src/decorator.py | 2 | ||||
| -rw-r--r-- | src/tests/documentation.py | 4 | ||||
| -rw-r--r-- | src/tests/test.py | 2 |
3 files changed, 8 insertions, 0 deletions
diff --git a/src/decorator.py b/src/decorator.py index 50876c6..09a466e 100644 --- a/src/decorator.py +++ b/src/decorator.py @@ -77,6 +77,7 @@ def getargspec(f): spec = getfullargspec(f) return ArgSpec(spec.args, spec.varargs, spec.varkw, spec.defaults) + DEF = re.compile('\s*def\s*([_\w][_\w\d]*)\s*\(') @@ -276,6 +277,7 @@ class ContextManager(_GeneratorContextManager): func, "with _self_: return _func_(%(shortsignature)s)", dict(_self_=self, _func_=func), __wrapped__=func) + init = getfullargspec(_GeneratorContextManager.__init__) n_args = len(init.args) if n_args == 2 and not init.varargs: # (self, genobj) Python 2.7 diff --git a/src/tests/documentation.py b/src/tests/documentation.py index e752c3f..8aa33c4 100644 --- a/src/tests/documentation.py +++ b/src/tests/documentation.py @@ -1481,6 +1481,7 @@ def a_test_for_pylons(): 'The good old factorial' """ + if sys.version >= '3': # tests for signatures specific to Python 3 def test_kwonlydefaults(): @@ -1529,6 +1530,7 @@ def before_after(before, after): yield print(after) + ba = before_after('BEFORE', 'AFTER') # ContextManager instance @@ -1636,6 +1638,8 @@ def get_length_set(obj): class C(object): "Registered as Sized and Iterable" + + collections.Sized.register(C) collections.Iterable.register(C) diff --git a/src/tests/test.py b/src/tests/test.py index 5bd34e8..da6bb73 100644 --- a/src/tests/test.py +++ b/src/tests/test.py @@ -92,6 +92,7 @@ class ExtraTestCase(unittest.TestCase): # 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 singledispatch = dispatch_on('obj') @@ -410,5 +411,6 @@ class TestSingleDispatch(unittest.TestCase): with assertRaises(RuntimeError): h(u) + if __name__ == '__main__': unittest.main() |
