From 0c1b5aa89ba72f976c0cacd17efd9912b0c39c8d Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Fri, 1 Feb 2008 20:32:37 +0100 Subject: [PATCH] new test for 'is None' in Python bool expression --- tests/run/isnonebool.pyx | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/run/isnonebool.pyx 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) -- 2.26.2