From: Robert Bradshaw Date: Wed, 11 Aug 2010 19:39:57 +0000 (-0700) Subject: Fix builtin bool tests. X-Git-Tag: 0.13.beta1~7 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=2c4afc4bf8527c27bcd2abebae70ad0b49ed6dac;p=cython.git Fix builtin bool tests. --- diff --git a/tests/run/cdef_bool_T227.pyx b/tests/run/cdef_bool_T227.pyx index 3fb8b7f8..1d4f2fc2 100644 --- a/tests/run/cdef_bool_T227.pyx +++ b/tests/run/cdef_bool_T227.pyx @@ -1,3 +1,5 @@ +from cpython.bool cimport bool + def foo(bool a): """ >>> foo(True) diff --git a/tests/run/isinstance.pyx b/tests/run/isinstance.pyx index 0519b346..b9ae36fe 100644 --- a/tests/run/isinstance.pyx +++ b/tests/run/isinstance.pyx @@ -1,5 +1,6 @@ cimport cython +from cpython.bool cimport bool cdef class A: pass @@ -33,7 +34,7 @@ def test_optimised(): # Optimized tests. assert isinstance(new_type, type) - assert isinstance(bool(), bool) + assert isinstance(True, bool) assert isinstance(int(), int) assert isinstance(long(), long) assert isinstance(float(), float) @@ -58,9 +59,8 @@ def test_optimised_tuple(): >>> test_optimised_tuple() True """ - assert isinstance(bool(), (bool, int, long, float, bytes, str, unicode, tuple, list, dict, set, slice)) - assert isinstance(int(), (bool, int, long, float, bytes, str, unicode, tuple, list, dict, set, slice)) - assert isinstance(list(), (bool, int, long, float, bytes, str, unicode, tuple, list, dict, set, slice)) + assert isinstance(int(), (int, long, float, bytes, str, unicode, tuple, list, dict, set, slice)) + assert isinstance(list(), (int, long, float, bytes, str, unicode, tuple, list, dict, set, slice)) return True @cython.test_assert_path_exists('//SimpleCallNode//SimpleCallNode') diff --git a/tests/run/type_inference.pyx b/tests/run/type_inference.pyx index 43c30c34..c567c128 100644 --- a/tests/run/type_inference.pyx +++ b/tests/run/type_inference.pyx @@ -4,6 +4,8 @@ cimport cython from cython cimport typeof, infer_types +from cpython cimport bool + ################################################## # type inference tests in 'full' mode @@ -48,7 +50,7 @@ def builtin_types(): d = dict() assert typeof(d) == "dict object", typeof(d) B = bool() - assert typeof(B) == "bool object", typeof(B) + assert typeof(B) == "bool", typeof(B) def slicing(): """