Add a test for docstring in call signature

This commit is contained in:
Takafumi Arakaki
2013-02-24 22:45:10 +01:00
parent d9ac630633
commit e1e2ed8fcc
2 changed files with 10 additions and 1 deletions

View File

@@ -169,7 +169,7 @@ class Instance(use_metaclass(cache.CachedMetaClass, Executable)):
def __getattr__(self, name):
if name not in ['start_pos', 'end_pos', 'name', 'get_imports',
'docstr', 'asserts']:
'doc', 'docstr', 'asserts']:
raise AttributeError("Instance %s: Don't touch this (%s)!"
% (self, name))
return getattr(self.base, name)

View File

@@ -90,6 +90,15 @@ class TestRegression(TestBase):
if not is_py25:
assert len(r[0].doc) > 100
def test_function_call_signature(self):
defs = self.definition("""
def f(x, y=1, z='a'):
pass
f""")
doc = defs[0].doc
doc = defs[0].doc # removing this line won't work
assert "f(x, y = 1, z = 'a')" in doc
def test_definition_at_zero(self):
assert self.definition("a", (1, 1)) == []
s = self.definition("str", (1, 1))