From: Stefan Behnel Date: Tue, 30 Dec 2008 12:03:52 +0000 (+0100) Subject: Py3 test case fix X-Git-Tag: 0.11-beta~57 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=636286bd0b9db3ca1236eff382f0408031cc2f53;p=cython.git Py3 test case fix --- diff --git a/tests/run/isinstance.pyx b/tests/run/isinstance.pyx index 7c3d7334..12dbd08c 100644 --- a/tests/run/isinstance.pyx +++ b/tests/run/isinstance.pyx @@ -5,9 +5,17 @@ True cdef class A: pass +import sys +IS_PY3 = sys.version_info[0] >= 3 + def test_all(): + if IS_PY3: + new_type = type(u'a',(),{}) + else: + new_type = type('a',(),{}) + # Optimized tests. - assert isinstance(type('a',(),{}), type) + assert isinstance(new_type, type) assert isinstance(bool(), bool) assert isinstance(int(), int) assert isinstance(long(), long) @@ -24,12 +32,11 @@ def test_all(): assert isinstance(slice(0), slice) assert isinstance(A, type) assert isinstance(A(), A) - assert not isinstance("foo", int) + assert not isinstance(u"foo", int) # Non-optimized foo = A assert isinstance(A(), foo) assert isinstance(0, (int, long)) - assert not isinstance("xyz", (int, long)) + assert not isinstance(u"xyz", (int, long)) return True -