new test for 'is None' in Python bool expression
authorStefan Behnel <scoder@users.berlios.de>
Fri, 1 Feb 2008 19:32:37 +0000 (20:32 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Fri, 1 Feb 2008 19:32:37 +0000 (20:32 +0100)
tests/run/isnonebool.pyx [new file with mode: 0644]

diff --git a/tests/run/isnonebool.pyx b/tests/run/isnonebool.pyx
new file mode 100644 (file)
index 0000000..1bee4ec
--- /dev/null
@@ -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)