Commit bda5bac1 authored by Stefan Behnel's avatar Stefan Behnel

fix AutoTestDictTransform for lambda expressions

parent 343f9796
...@@ -57,6 +57,11 @@ class AutoTestDictTransform(ScopeTrackingTransform): ...@@ -57,6 +57,11 @@ class AutoTestDictTransform(ScopeTrackingTransform):
value = UnicodeNode(pos, value=doctest) value = UnicodeNode(pos, value=doctest)
self.tests.append(DictItemNode(pos, key=key, value=value)) self.tests.append(DictItemNode(pos, key=key, value=value))
def visit_ExprNode(self, node):
# expressions cannot contain functions and lambda expressions
# do not have a docstring
return node
def visit_FuncDefNode(self, node): def visit_FuncDefNode(self, node):
if not node.doc: if not node.doc:
return node return node
......
...@@ -10,10 +10,10 @@ all_tests_run() is executed which does final validation. ...@@ -10,10 +10,10 @@ all_tests_run() is executed which does final validation.
>>> items.sort() >>> items.sort()
>>> for key, value in items: >>> for key, value in items:
... print('%s ; %s' % (key, value)) ... print('%s ; %s' % (key, value))
MyCdefClass.cpdef_method (line 76) ; >>> add_log("cpdef class method") MyCdefClass.cpdef_method (line 77) ; >>> add_log("cpdef class method")
MyCdefClass.method (line 73) ; >>> add_log("cdef class method") MyCdefClass.method (line 74) ; >>> add_log("cdef class method")
MyClass.method (line 62) ; >>> add_log("class method") MyClass.method (line 63) ; >>> add_log("class method")
mycpdeffunc (line 49) ; >>> add_log("cpdef") mycpdeffunc (line 50) ; >>> add_log("cpdef")
myfunc (line 40) ; >>> add_log("def") myfunc (line 40) ; >>> add_log("def")
""" """
...@@ -39,6 +39,7 @@ def add_log(s): ...@@ -39,6 +39,7 @@ def add_log(s):
def myfunc(): def myfunc():
""">>> add_log("def")""" """>>> add_log("def")"""
x = lambda a:1 # no docstring here ...
def doc_without_test(): def doc_without_test():
"""Some docs""" """Some docs"""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment