diff options
-rw-r--r-- | tests/run/isnot.pyx | 11 | ||||
-rw-r--r-- | tests/run/knuth_man_or_boy_test.pyx | 6 |
2 files changed, 13 insertions, 4 deletions
diff --git a/tests/run/isnot.pyx b/tests/run/isnot.pyx index 9baabbc7e..f7efd017d 100644 --- a/tests/run/isnot.pyx +++ b/tests/run/isnot.pyx @@ -3,12 +3,17 @@ cimport cython +# Use a single global object for identity checks. +# PyPy can optimise away integer objects, for example, and may fail the 'is' test. +obj = object() + + @cython.test_fail_if_path_exists('//NotNode') def is_not(a, b): """ >>> is_not(1, 2) True - >>> x = 1 + >>> x = obj >>> is_not(x, x) False """ @@ -20,7 +25,7 @@ def not_is_not(a, b): """ >>> not_is_not(1, 2) False - >>> x = 1 + >>> x = obj >>> not_is_not(x, x) True """ @@ -32,7 +37,7 @@ def not_is(a, b): """ >>> not_is(1, 2) True - >>> x = 1 + >>> x = obj >>> not_is(x, x) False """ diff --git a/tests/run/knuth_man_or_boy_test.pyx b/tests/run/knuth_man_or_boy_test.pyx index 068cec524..d2b5c8825 100644 --- a/tests/run/knuth_man_or_boy_test.pyx +++ b/tests/run/knuth_man_or_boy_test.pyx @@ -46,9 +46,13 @@ def compute(val): def a(in_k, x1, x2, x3, x4, x5): """ >>> import sys - >>> sys.setrecursionlimit(1350) + >>> old_limit = sys.getrecursionlimit() + >>> sys.setrecursionlimit(1350 if not getattr(sys, 'pypy_version_info', None) else 2700) + >>> a(10, 1, -1, -1, 1, 0) -67 + + >>> sys.setrecursionlimit(old_limit) """ k = [in_k] def b(): |