diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2003-06-27 18:43:12 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2003-06-27 18:43:12 (GMT) |
commit | c4bf5edc3a5d404806b1f701653ec3187d5a1a7f (patch) | |
tree | 87f253d2cc7e9bfdf991b170203e13b18562707f /Lib/test/test_inspect.py | |
parent | ab91902f6f2f2fe5aac97132627eda6a95aea8a9 (diff) | |
download | cpython-c4bf5edc3a5d404806b1f701653ec3187d5a1a7f.zip cpython-c4bf5edc3a5d404806b1f701653ec3187d5a1a7f.tar.gz cpython-c4bf5edc3a5d404806b1f701653ec3187d5a1a7f.tar.bz2 |
Add a trivial test of getargspec() with a method.
Diffstat (limited to 'Lib/test/test_inspect.py')
-rw-r--r-- | Lib/test/test_inspect.py | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py index c67c23c..9da6694 100644 --- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -152,22 +152,6 @@ test(inspect.getdoc(git.abuse) == test(inspect.getcomments(mod.StupidGit) == '# line 20\n', 'getcomments(mod.StupidGit)') -args, varargs, varkw, defaults = inspect.getargspec(mod.eggs) -test(args == ['x', 'y'], 'mod.eggs args') -test(varargs == None, 'mod.eggs varargs') -test(varkw == None, 'mod.eggs varkw') -test(defaults == None, 'mod.eggs defaults') -test(inspect.formatargspec(args, varargs, varkw, defaults) == - '(x, y)', 'mod.eggs formatted argspec') -args, varargs, varkw, defaults = inspect.getargspec(mod.spam) -test(args == ['a', 'b', 'c', 'd', ['e', ['f']]], 'mod.spam args') -test(varargs == 'g', 'mod.spam varargs') -test(varkw == 'h', 'mod.spam varkw') -test(defaults == (3, (4, (5,))), 'mod.spam defaults') -test(inspect.formatargspec(args, varargs, varkw, defaults) == - '(a, b, c, d=3, (e, (f,))=(4, (5,)), *g, **h)', - 'mod.spam formatted argspec') - git.abuse(7, 8, 9) istest(inspect.istraceback, 'git.ex[2]') @@ -365,3 +349,24 @@ test(('p', 'property', A) in attrs, 'missing property') test(('m', 'method', B) in attrs, 'missing plain method') test(('m1', 'method', D) in attrs, 'missing plain method') test(('datablob', 'data', A) in attrs, 'missing data') + +args, varargs, varkw, defaults = inspect.getargspec(mod.eggs) +test(args == ['x', 'y'], 'mod.eggs args') +test(varargs == None, 'mod.eggs varargs') +test(varkw == None, 'mod.eggs varkw') +test(defaults == None, 'mod.eggs defaults') +test(inspect.formatargspec(args, varargs, varkw, defaults) == + '(x, y)', 'mod.eggs formatted argspec') +args, varargs, varkw, defaults = inspect.getargspec(mod.spam) +test(args == ['a', 'b', 'c', 'd', ['e', ['f']]], 'mod.spam args') +test(varargs == 'g', 'mod.spam varargs') +test(varkw == 'h', 'mod.spam varkw') +test(defaults == (3, (4, (5,))), 'mod.spam defaults') +test(inspect.formatargspec(args, varargs, varkw, defaults) == + '(a, b, c, d=3, (e, (f,))=(4, (5,)), *g, **h)', + 'mod.spam formatted argspec') +args, varargs, varkw, defaults = inspect.getargspec(A.m) +test(args == ['self'], 'A.m args') +test(varargs is None, 'A.m varargs') +test(varkw is None, 'A.m varkw') +test(defaults is None, 'A.m defaults') |