Commit 636286bd authored by Stefan Behnel's avatar Stefan Behnel

Py3 test case fix

parent bf6946d4
...@@ -5,9 +5,17 @@ True ...@@ -5,9 +5,17 @@ True
cdef class A: cdef class A:
pass pass
import sys
IS_PY3 = sys.version_info[0] >= 3
def test_all(): def test_all():
if IS_PY3:
new_type = type(u'a',(),{})
else:
new_type = type('a',(),{})
# Optimized tests. # Optimized tests.
assert isinstance(type('a',(),{}), type) assert isinstance(new_type, type)
assert isinstance(bool(), bool) assert isinstance(bool(), bool)
assert isinstance(int(), int) assert isinstance(int(), int)
assert isinstance(long(), long) assert isinstance(long(), long)
...@@ -24,12 +32,11 @@ def test_all(): ...@@ -24,12 +32,11 @@ def test_all():
assert isinstance(slice(0), slice) assert isinstance(slice(0), slice)
assert isinstance(A, type) assert isinstance(A, type)
assert isinstance(A(), A) assert isinstance(A(), A)
assert not isinstance("foo", int) assert not isinstance(u"foo", int)
# Non-optimized # Non-optimized
foo = A foo = A
assert isinstance(A(), foo) assert isinstance(A(), foo)
assert isinstance(0, (int, long)) assert isinstance(0, (int, long))
assert not isinstance("xyz", (int, long)) assert not isinstance(u"xyz", (int, long))
return True return True
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment