From b1fbfb0eb4040557d82ce0216e2d8975ba35586c Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Thu, 15 Oct 2009 03:01:39 -0700 Subject: [PATCH] short circut bug test #404 --- tests/run/short_circuit_T404.pyx | 41 ++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tests/run/short_circuit_T404.pyx diff --git a/tests/run/short_circuit_T404.pyx b/tests/run/short_circuit_T404.pyx new file mode 100644 index 00000000..7ef2105b --- /dev/null +++ b/tests/run/short_circuit_T404.pyx @@ -0,0 +1,41 @@ +cdef long foo(long x): + print "foo(%s)" % x + return x + +def test_or(long a, long b): + """ + >>> test_or(1,2) + foo(1) + True + >>> test_or(1,0) + foo(1) + True + >>> test_or(0,2) + foo(0) + foo(2) + True + >>> test_or(0,0) + foo(0) + foo(0) + False + """ + print foo(a) or foo(b) + +def test_and(long a, long b): + """ + >>> test_and(1,2) + foo(1) + foo(2) + True + >>> test_and(1,0) + foo(1) + foo(0) + False + >>> test_and(0,2) + foo(0) + False + >>> test_and(0,0) + foo(0) + False + """ + print foo(a) and foo(b) -- 2.26.2