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
6fcb8ca7
Commit
6fcb8ca7
authored
Feb 21, 2009
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Py3 test fixes
parent
f630c04f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
63 additions
and
18 deletions
+63
-18
tests/run/cdef_opt.pyx
tests/run/cdef_opt.pyx
+29
-5
tests/run/iteratorexception.pyx
tests/run/iteratorexception.pyx
+4
-2
tests/run/literal_lists.pyx
tests/run/literal_lists.pyx
+9
-5
tests/run/slice_charptr.pyx
tests/run/slice_charptr.pyx
+9
-4
tests/run/unsigned.pyx
tests/run/unsigned.pyx
+12
-2
No files found.
tests/run/cdef_opt.pyx
View file @
6fcb8ca7
__doc__
=
u"""
>>> a = A()
>>> a.foo()
(True, 'yo')
(True,
u
'yo')
>>> a.foo(False)
(False, 'yo')
>>> a.foo(10, 'yes')
(True, 'yes')
(False, u'yo')
>>> a.foo(10, u'yes')
(True, u'yes')
>>> call0()
(True, u'yo')
>>> call1()
(False, u'yo')
>>> call2()
(False, u'go')
"""
import
sys
if
sys
.
version_info
[
0
]
>=
3
:
__doc__
=
__doc__
.
replace
(
u"u'"
,
u"'"
)
cdef
class
A
:
cpdef
foo
(
self
,
bint
a
=
True
,
b
=
"yo"
):
cpdef
foo
(
self
,
bint
a
=
True
,
b
=
u
"yo"
):
return
a
,
b
def
call0
():
a
=
A
()
return
a
.
foo
()
def
call1
():
a
=
A
()
return
a
.
foo
(
False
)
def
call2
():
a
=
A
()
return
a
.
foo
(
False
,
u"go"
)
tests/run/iteratorexception.pyx
View file @
6fcb8ca7
...
...
@@ -4,7 +4,9 @@ __doc__ = u"""
class
IteratorAndIterateable
:
def
next
(
self
):
raise
ValueError
(
""
)
raise
ValueError
def
__next__
(
self
):
raise
ValueError
def
__iter__
(
self
):
return
self
...
...
@@ -12,6 +14,6 @@ def f():
try
:
for
x
in
IteratorAndIterateable
():
pass
assert
False
,
"Should not reach this point, iterator has thrown exception"
assert
False
,
u
"Should not reach this point, iterator has thrown exception"
except
ValueError
:
pass
tests/run/literal_lists.pyx
View file @
6fcb8ca7
__doc__
=
u"""
>>> test_ints(100)
(100, 100, 100)
>>> test_chars(
"yo"
)
(
'a', 'bc',
'yo')
>>> test_chars(None)
>>> test_chars(
b'yo'
)
(
b'a', b'bc', b
'yo')
>>> test_chars(None)
# doctest: +ELLIPSIS
Traceback (most recent call last):
...
TypeError: expected string or Unicode object, NoneType found
TypeError: expected ...
>>> test_struct(-5, -10)
-5 -10 True
1 2 False
"""
import
sys
if
sys
.
version_info
[
0
]
<
3
:
__doc__
=
__doc__
.
replace
(
u"b'"
,
u"'"
)
def
test_ints
(
int
x
):
cdef
list
L
=
[
1
,
2
,
3
,
x
]
cdef
int
*
Li
=
[
1
,
2
,
3
,
x
]
...
...
tests/run/slice_charptr.pyx
View file @
6fcb8ca7
__doc__
=
u"""
>>> do_slice(
"abcdef".encode(u"ASCII")
, 2, 3)
(
'c', 'cdef', 'ab',
'abcdef')
>>> do_slice(
"abcdef".encode(u"ASCII")
, 0, 5)
(
'abcde', 'abcdef', '',
'abcdef')
>>> do_slice(
b"abcdef"
, 2, 3)
(
b'c', b'cdef', b'ab', b
'abcdef')
>>> do_slice(
b"abcdef"
, 0, 5)
(
b'abcde', b'abcdef', b'', b
'abcdef')
"""
import
sys
if
sys
.
version_info
[
0
]
<
3
:
__doc__
=
__doc__
.
replace
(
u"(b'"
,
u"('"
).
replace
(
u" b'"
,
u" '"
)
def
do_slice
(
s
,
int
i
,
int
j
):
cdef
char
*
ss
=
s
return
ss
[
i
:
j
],
ss
[
i
:],
ss
[:
i
],
ss
[:]
...
...
tests/run/unsigned.pyx
View file @
6fcb8ca7
__doc__
=
u"""
import
sys
if
sys
.
version_info
[
0
]
>=
3
:
__doc__
=
u"""
>>> test_signed()
3 <class 'int'>
9 <class 'int'>
6 <class 'int'>
12 <class 'int'>
"""
else
:
__doc__
=
u"""
>>> test_signed()
3 <type 'int'>
9 <type 'long'>
...
...
@@ -6,7 +17,6 @@ __doc__ = u"""
12 <type 'long'>
"""
cdef
int
i
=
1
cdef
long
l
=
2
cdef
unsigned
int
ui
=
4
...
...
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