Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
cython
Commits
1283615a
Commit
1283615a
authored
Apr 02, 2011
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better bint type printing, tests
parent
18f44348
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
14 deletions
+35
-14
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+3
-0
tests/run/bint.pyx
tests/run/bint.pyx
+32
-14
No files found.
Cython/Compiler/PyrexTypes.py
View file @
1283615a
...
...
@@ -925,6 +925,9 @@ class CBIntType(CIntType):
def
__repr__
(
self
):
return
"<CNumericType bint>"
def
__str__
(
self
):
return
'bint'
class
CPyUCS4IntType
(
CIntType
):
# Py_UCS4
...
...
tests/run/bint.pyx
View file @
1283615a
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
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment