From: Stefan Behnel Date: Fri, 1 Feb 2008 19:32:37 +0000 (+0100) Subject: new test for 'is None' in Python bool expression X-Git-Tag: 0.9.6.14~45^2~8 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0c1b5aa89ba72f976c0cacd17efd9912b0c39c8d;p=cython.git new test for 'is None' in Python bool expression --- diff --git a/tests/run/isnonebool.pyx b/tests/run/isnonebool.pyx new file mode 100644 index 00000000..1bee4ec9 --- /dev/null +++ b/tests/run/isnonebool.pyx @@ -0,0 +1,23 @@ +__doc__ = """ + >>> test_and(None, None) + True + >>> test_and(None, 1) + False + >>> test_and(1, None) + False + + >>> test_more(None, None) + True + >>> test_more(None, 1) + True + >>> test_more(1, None) + False + >>> test_more(None, 0) + False +""" + +def test_and(a,b): + return a is None and b is None + +def test_more(a,b): + return a is None and (b is None or b == 1)