diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2006-03-27 08:58:23 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-03-27 08:58:23 (GMT) |
commit | 33b730e33cb0a63f4030d1587a6196dcde36e965 (patch) | |
tree | 1f20b2cdd510692f3904ddb85b0bf446994b4d66 /Lib/test/test_inspect.py | |
parent | 6c403597954487e8129221351f72da3735c52c09 (diff) | |
download | cpython-33b730e33cb0a63f4030d1587a6196dcde36e965.zip cpython-33b730e33cb0a63f4030d1587a6196dcde36e965.tar.gz cpython-33b730e33cb0a63f4030d1587a6196dcde36e965.tar.bz2 |
Fix SF bug #1458903 with AST compiler.
def foo((x)): was getting recognized as requiring tuple unpacking
which is not correct.
Add tests for this case and the proper way to unpack a tuple of one:
def foo((x,)):
test_inpsect was incorrect before. I'm not sure why it was passing,
but that has been corrected with a test for both functions above.
This means the test (and therefore inspect.getargspec()) are broken in 2.4.
Diffstat (limited to 'Lib/test/test_inspect.py')
-rw-r--r-- | Lib/test/test_inspect.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py index ce346b9..79be369 100644 --- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -304,10 +304,12 @@ class TestClassesAndFunctions(unittest.TestCase): self.assertArgSpecEquals(A.m, ['self']) def test_getargspec_sublistofone(self): - def sublistOfOne((foo)): return 1 - + def sublistOfOne((foo,)): return 1 self.assertArgSpecEquals(sublistOfOne, [['foo']]) + def fakeSublistOfOne((foo)): return 1 + self.assertArgSpecEquals(fakeSublistOfOne, ['foo']) + def test_classify_oldstyle(self): class A: def s(): pass |