From: Stefan Behnel Date: Sun, 4 Oct 2009 19:44:03 +0000 (+0200) Subject: test for 'first assignment' algorithm X-Git-Tag: 0.12.alpha0~182^2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=fbc20b57a902c689e6f76f6c043ab34c47f75ef0;p=cython.git test for 'first assignment' algorithm --- diff --git a/tests/compile/first_assignment.pyx b/tests/compile/first_assignment.pyx new file mode 100644 index 00000000..2bd74d02 --- /dev/null +++ b/tests/compile/first_assignment.pyx @@ -0,0 +1,31 @@ + +cimport cython + +@cython.test_assert_path_exists( + "//SingleAssignmentNode", + "//SingleAssignmentNode[./NameNode[@name = 'a']]", + "//SingleAssignmentNode[./NameNode[@name = 'a'] and @first = True]", + ) +def test_cdef(): + cdef int a = 1 + +@cython.test_assert_path_exists( + "//SingleAssignmentNode", + "//SingleAssignmentNode[./NameNode[@name = 'a']]", +# FIXME: currently not working +# "//SingleAssignmentNode[./NameNode[@name = 'a'] and @first = True]", + ) +def test_py(): + a = 1 + +@cython.test_assert_path_exists( + "//SingleAssignmentNode", + "//SingleAssignmentNode[./NameNode[@name = 'a']]", +# FIXME: currently not working +# "//SingleAssignmentNode[./NameNode[@name = 'a'] and @first = True]", + ) +def test_cond(): + if True: + a = 1 + else: + a = 2