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
e69a1fa5
Commit
e69a1fa5
authored
Nov 23, 2013
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make an old test from 'broken' directory usable
parent
53595204
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
2 deletions
+41
-2
tests/run/extcmethod.pyx
tests/run/extcmethod.pyx
+41
-2
No files found.
tests/run/extcmethod.pyx
View file @
e69a1fa5
# mode: run
cdef
class
Spam
:
cdef
int
tons
...
...
@@ -13,14 +14,16 @@ cdef class Spam:
def
lift
(
self
):
print
self
.
tons
cdef
class
SubSpam
(
Spam
):
cdef
void
add_tons
(
self
,
int
x
):
self
.
tons
+=
2
*
x
def
test
():
def
test_spam
():
"""
>>> test()
>>> test
_spam
()
5
0
20
...
...
@@ -41,3 +44,39 @@ def test():
ss
.
lift
()
s
.
lift
()
cdef
class
SpamDish
:
cdef
int
spam
cdef
void
describe
(
self
):
print
"This dish contains"
,
self
.
spam
,
"tons of spam."
cdef
class
FancySpamDish
(
SpamDish
):
cdef
int
lettuce
cdef
void
describe
(
self
):
print
"This dish contains"
,
self
.
spam
,
"tons of spam"
,
print
"and"
,
self
.
lettuce
,
"milligrams of lettuce."
cdef
void
describe_dish
(
SpamDish
d
):
d
.
describe
()
def
test_spam_dish
():
"""
>>> test_spam_dish()
This dish contains 42 tons of spam.
This dish contains 88 tons of spam and 5 milligrams of lettuce.
"""
cdef
SpamDish
s
cdef
FancySpamDish
ss
s
=
SpamDish
()
s
.
spam
=
42
ss
=
FancySpamDish
()
ss
.
spam
=
88
ss
.
lettuce
=
5
describe_dish
(
s
)
describe_dish
(
ss
)
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