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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
257e19b0
Commit
257e19b0
authored
May 04, 2011
by
Vitja Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add some more CF tests
parent
ee517ea7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
0 deletions
+60
-0
tests/errors/w_uninitialized.pyx
tests/errors/w_uninitialized.pyx
+10
-0
tests/errors/w_uninitialized_exc.pyx
tests/errors/w_uninitialized_exc.pyx
+26
-0
tests/errors/w_uninitialized_for.pyx
tests/errors/w_uninitialized_for.pyx
+24
-0
No files found.
tests/errors/w_uninitialized.pyx
View file @
257e19b0
...
...
@@ -54,10 +54,20 @@ def dict_comp(a):
def
generic_args_call
(
*
args
,
**
kwargs
):
return
args
,
kwargs
def
cascaded
(
x
):
print
a
,
b
a
=
b
=
x
def
from_import
():
print
bar
from
foo
import
bar
_ERRORS
=
"""
6:11: local variable 'a' referenced before assignment
12:12: local variable 'a' might be referenced before assignment
29:12: local variable 'a' might be referenced before assignment
35:15: local variable 'b' might be referenced before assignment
58:11: local variable 'a' referenced before assignment
58:14: local variable 'b' referenced before assignment
62:13: local variable 'bar' referenced before assignment
"""
tests/errors/w_uninitialized_exc.pyx
View file @
257e19b0
...
...
@@ -68,10 +68,36 @@ def exc_assmt_finaly(a):
except
:
return
x
def
raise_stat
(
a
):
try
:
if
a
<
0
:
raise
IndexError
except
IndexError
:
oops
=
1
print
oops
def
try_loop
(
args
):
try
:
x
=
0
for
i
in
args
:
if
i
is
0
:
continue
elif
i
is
None
:
break
elif
i
is
False
:
return
i
()
except
ValueError
:
x
=
1
finally
:
return
x
_ERRORS
=
"""
12:12: local variable 'e' might be referenced before assignment
12:15: local variable 'i' might be referenced before assignment
19:12: local variable 'a' might be referenced before assignment
63:16: local variable 'x' might be referenced before assignment
69:16: local variable 'x' might be referenced before assignment
77:14: local variable 'oops' might be referenced before assignment
93:16: local variable 'x' might be referenced before assignment
"""
tests/errors/w_uninitialized_for.pyx
View file @
257e19b0
...
...
@@ -30,9 +30,33 @@ def simple_target_f(n):
i
*=
i
return
i
def
simple_for_from
(
n
):
for
i
from
0
<=
i
<=
n
:
x
=
i
else
:
return
x
def
for_continue
(
l
):
for
i
in
l
:
if
i
>
0
:
continue
x
=
i
print
x
def
for_break
(
l
):
for
i
in
l
:
if
i
>
0
:
break
x
=
i
print
x
_ERRORS
=
"""
8:12: local variable 'a' might be referenced before assignment
14:12: local variable 'a' might be referenced before assignment
26:12: local variable 'i' might be referenced before assignment
31:12: local variable 'i' might be referenced before assignment
37:16: local variable 'x' might be referenced before assignment
44:11: local variable 'x' might be referenced before assignment
51:11: local variable 'x' might be referenced before assignment
"""
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