-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)