From bda5bac107257ff75a5003b95931d743f319cd32 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Tue, 23 Nov 2010 20:16:07 +0100 Subject: [PATCH] fix AutoTestDictTransform for lambda expressions --- Cython/Compiler/AnalysedTreeTransforms.py | 5 +++++ tests/run/autotestdict.pyx | 9 +++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Cython/Compiler/AnalysedTreeTransforms.py b/Cython/Compiler/AnalysedTreeTransforms.py index 38712049..79a0485e 100644 --- a/Cython/Compiler/AnalysedTreeTransforms.py +++ b/Cython/Compiler/AnalysedTreeTransforms.py @@ -57,6 +57,11 @@ class AutoTestDictTransform(ScopeTrackingTransform): value = UnicodeNode(pos, value=doctest) 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): if not node.doc: return node diff --git a/tests/run/autotestdict.pyx b/tests/run/autotestdict.pyx index 1e740c08..1df98968 100644 --- a/tests/run/autotestdict.pyx +++ b/tests/run/autotestdict.pyx @@ -10,10 +10,10 @@ all_tests_run() is executed which does final validation. >>> items.sort() >>> for key, value in items: ... print('%s ; %s' % (key, value)) -MyCdefClass.cpdef_method (line 76) ; >>> add_log("cpdef class method") -MyCdefClass.method (line 73) ; >>> add_log("cdef class method") -MyClass.method (line 62) ; >>> add_log("class method") -mycpdeffunc (line 49) ; >>> add_log("cpdef") +MyCdefClass.cpdef_method (line 77) ; >>> add_log("cpdef class method") +MyCdefClass.method (line 74) ; >>> add_log("cdef class method") +MyClass.method (line 63) ; >>> add_log("class method") +mycpdeffunc (line 50) ; >>> add_log("cpdef") myfunc (line 40) ; >>> add_log("def") """ @@ -39,6 +39,7 @@ def add_log(s): def myfunc(): """>>> add_log("def")""" + x = lambda a:1 # no docstring here ... def doc_without_test(): """Some docs""" -- 2.26.2