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
65b6ca34
Commit
65b6ca34
authored
Dec 16, 2010
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
working test for ticket #87
parent
7a17001d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
0 deletions
+58
-0
tests/run/class_func_in_control_structures_T87.pyx
tests/run/class_func_in_control_structures_T87.pyx
+58
-0
No files found.
tests/run/class_func_in_control_structures_T87.pyx
0 → 100644
View file @
65b6ca34
__doc__
=
u"""
>>> d = Defined()
>>> n = NotDefined()
Traceback (most recent call last):
NameError: name 'NotDefined' is not defined
"""
if
True
:
class
Defined
(
object
):
"""
>>> isinstance(Defined(), Defined)
True
"""
if
False
:
class
NotDefined
(
object
):
"""
>>> NotDefined() # fails when defined
"""
def
test_class_cond
(
x
):
"""
>>> Test, test = test_class_cond(True)
>>> test.A
1
>>> Test().A
1
>>> Test, test = test_class_cond(False)
>>> test.A
2
>>> Test().A
2
"""
if
x
:
class
Test
(
object
):
A
=
1
else
:
class
Test
(
object
):
A
=
2
return
Test
,
Test
()
def
test_func_cond
(
x
):
"""
>>> func = test_func_cond(True)
>>> func()
1
>>> func = test_func_cond(False)
>>> func()
2
"""
if
x
:
def
func
():
return
1
else
:
def
func
():
return
2
return
func
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