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
Gwenaël Samain
cython
Commits
20f13f93
Commit
20f13f93
authored
Dec 04, 2009
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simple test case for safe double inference
parent
43173842
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
tests/run/type_inference.pyx
tests/run/type_inference.pyx
+18
-0
No files found.
tests/run/type_inference.pyx
View file @
20f13f93
# cython: infer_types = all
# cython: infer_types = all
cimport
cython
from
cython
cimport
typeof
,
infer_types
from
cython
cimport
typeof
,
infer_types
cdef
class
MyType
:
cdef
class
MyType
:
...
@@ -147,6 +148,23 @@ def loop():
...
@@ -147,6 +148,23 @@ def loop():
pass
pass
assert
typeof
(
a
)
==
"long"
assert
typeof
(
a
)
==
"long"
@
cython
.
test_fail_if_path_exists
(
'//NameNode[@type.is_pyobject = True]'
)
@
cython
.
test_assert_path_exists
(
'//InPlaceAssignmentNode/NameNode'
,
'//NameNode[@type.is_pyobject]'
,
'//NameNode[@type.is_pyobject = False]'
)
@
infer_types
(
'safe'
)
def
double_loop
():
"""
>>> double_loop() == 1.0 * 10
True
"""
cdef
int
i
d
=
1.0
for
i
in
range
(
9
):
d
+=
1.0
return
d
cdef
unicode
retu
():
cdef
unicode
retu
():
return
u"12345"
return
u"12345"
...
...
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