From: Stefan Behnel Date: Thu, 4 Dec 2008 20:08:14 +0000 (+0100) Subject: same test for 'and' operator X-Git-Tag: 0.11-beta~160 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0eedf9cbd04be8b83a5663a751548bd072cc9efa;p=cython.git same test for 'and' operator --- diff --git a/tests/run/and.pyx b/tests/run/and.pyx new file mode 100644 index 00000000..86165930 --- /dev/null +++ b/tests/run/and.pyx @@ -0,0 +1,51 @@ +u""" +>>> a,b = 'a *','b *' # use non-interned strings + +>>> and2_assign(2,3) == (2 and 3) +True +>>> and2_assign('a', 'b') == ('a' and 'b') +True +>>> and2_assign(a, b) == (a and b) +True + +>>> and2(2,3) == (2 and 3) +True +>>> and2(0,2) == (0 and 2) +True +>>> and2('a', 'b') == ('a' and 'b') +True +>>> and2(a, b) == (a and b) +True +>>> and2('', 'b') == ('' and 'b') +True +>>> and2([], [1]) == ([] and [1]) +True +>>> and2([], [a]) == ([] and [a]) +True + +>>> and3(0,1,2) == (0 and 1 and 2) +True +>>> and3([],(),[1]) == ([] and () and [1]) +True + +>>> and2_no_result(2,3) +>>> and2_no_result(0,2) +>>> and2_no_result('a','b') +>>> and2_no_result(a,b) +>>> a and b +'b *' +""" + +def and2_assign(a,b): + c = a and b + return c + +def and2(a,b): + return a and b + +def and3(a,b,c): + d = a and b and c + return d + +def and2_no_result(a,b): + a and b