Commit 1283615a authored by Robert Bradshaw's avatar Robert Bradshaw

better bint type printing, tests

parent 18f44348
......@@ -925,6 +925,9 @@ class CBIntType(CIntType):
def __repr__(self):
return "<CNumericType bint>"
def __str__(self):
return 'bint'
class CPyUCS4IntType(CIntType):
# Py_UCS4
......
cdef test(bint value):
print value
from cython cimport typeof
def call_test():
def test(bint value):
"""
>>> call_test()
False
>>> test(True)
True
>>> test(False)
False
>>> test(None)
False
>>> test(0)
False
>>> test(1)
True
>>> test(-1)
True
>>> test(100)
True
>>> test(0.0)
False
>>> test(0.1)
True
>>> test([])
False
>>> test([1, 2, 3])
True
"""
test(False)
test(True)
test(0)
test(234)
test(-1)
x = True
test(x)
x = 3242
test(x)
return value
def test_types(bint a):
"""
>>> test_types(None)
"""
cdef bint b = a
assert typeof(a) == 'bint', typeof(a)
assert typeof(b) == 'bint', typeof(b)
c = b
assert typeof(c) == 'bint', typeof(c)
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