Commit 78621780 authored by Stefan Behnel's avatar Stefan Behnel

slightly extended test case

parent f57f9f76
...@@ -29,23 +29,63 @@ def test_optimised(): ...@@ -29,23 +29,63 @@ def test_optimised():
>>> test_optimised() >>> test_optimised()
True True
""" """
new_type = type('a',(),{})
# Optimized tests. # Optimized tests.
cdef object new_type = type('a',(),{})
assert isinstance(type('a',(),{}), type)
assert isinstance(new_type, type) assert isinstance(new_type, type)
cdef object boolval = True
assert isinstance(boolval, bool)
assert isinstance(True, bool) assert isinstance(True, bool)
cdef object intval = int()
assert isinstance(intval, int)
assert isinstance(int(), int) assert isinstance(int(), int)
cdef object longval = long()
assert isinstance(longval, long)
assert isinstance(long(), long) assert isinstance(long(), long)
cdef object floatval = float()
assert isinstance(floatval, float)
assert isinstance(float(), float) assert isinstance(float(), float)
cdef object bytesval = bytes()
assert isinstance(bytesval, bytes)
assert isinstance(bytes(), bytes) assert isinstance(bytes(), bytes)
cdef object strval = str()
assert isinstance(strval, str)
assert isinstance(str(), str) assert isinstance(str(), str)
cdef object unicodeval = unicode()
assert isinstance(unicodeval, unicode)
assert isinstance(unicode(), unicode) assert isinstance(unicode(), unicode)
cdef object tupleval = tuple()
assert isinstance(tupleval, tuple)
assert isinstance(tuple(), tuple) assert isinstance(tuple(), tuple)
cdef object listval = list()
assert isinstance(listval, list)
assert isinstance(list(), list) assert isinstance(list(), list)
cdef object dictval = dict()
assert isinstance(dictval, dict)
assert isinstance(dict(), dict) assert isinstance(dict(), dict)
cdef object setval = set()
assert isinstance(setval, set)
assert isinstance(set(), set) assert isinstance(set(), set)
cdef object sliceval = slice(0)
assert isinstance(sliceval, slice)
assert isinstance(slice(0), slice) assert isinstance(slice(0), slice)
cdef object complexval = complex()
assert isinstance(complexval, complex)
assert isinstance(complex(), complex) assert isinstance(complex(), complex)
assert not isinstance(u"foo", int) assert not isinstance(u"foo", int)
assert isinstance(A, type) assert isinstance(A, type)
assert isinstance(A(), A) assert isinstance(A(), A)
......
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