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
481d7bec
Commit
481d7bec
authored
May 15, 2008
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lots of test fixes for Py3
parent
315de331
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
66 additions
and
41 deletions
+66
-41
tests/run/r_barbieri1.pyx
tests/run/r_barbieri1.pyx
+4
-0
tests/run/r_bowden1.pyx
tests/run/r_bowden1.pyx
+2
-2
tests/run/r_docstrings.pyx
tests/run/r_docstrings.pyx
+18
-14
tests/run/r_extcomplex2.pyx
tests/run/r_extcomplex2.pyx
+2
-2
tests/run/r_huss3.pyx
tests/run/r_huss3.pyx
+4
-0
tests/run/r_mitch_chapman_2.pyx
tests/run/r_mitch_chapman_2.pyx
+8
-4
tests/run/r_primes.pyx
tests/run/r_primes.pyx
+1
-1
tests/run/r_pythonapi.pyx
tests/run/r_pythonapi.pyx
+6
-2
tests/run/r_spamtype.pyx
tests/run/r_spamtype.pyx
+2
-2
tests/run/r_vree_1.pyx
tests/run/r_vree_1.pyx
+1
-1
tests/run/simpcall.pyx
tests/run/simpcall.pyx
+5
-1
tests/run/slice3.pyx
tests/run/slice3.pyx
+3
-3
tests/run/starargs.pyx
tests/run/starargs.pyx
+1
-1
tests/run/strconstinclass.pyx
tests/run/strconstinclass.pyx
+1
-1
tests/run/strfunction.pyx
tests/run/strfunction.pyx
+8
-7
No files found.
tests/run/r_barbieri1.pyx
View file @
481d7bec
...
@@ -6,6 +6,10 @@ __doc__ = u"""
...
@@ -6,6 +6,10 @@ __doc__ = u"""
Exception: crash-me
Exception: crash-me
"""
"""
import
sys
if
sys
.
version_info
[
0
]
>=
3
:
__doc__
=
__doc__
.
replace
(
u"Exception, e'"
,
u"Exception as e"
)
cdef
class
A
:
cdef
class
A
:
def
__cinit__
(
self
):
def
__cinit__
(
self
):
raise
Exception
(
"crash-me"
)
raise
Exception
(
"crash-me"
)
...
...
tests/run/r_bowden1.pyx
View file @
481d7bec
__doc__
=
u"""
__doc__
=
u"""
>>>
print
f(100)
>>> f(100)
101
101
>>>
print
g(3000000000)
>>> g(3000000000)
3000000001
3000000001
"""
"""
...
...
tests/run/r_docstrings.pyx
View file @
481d7bec
__doc__
=
u"""
__doc__
=
u"""
>>> f.__doc__
>>> f.__doc__
'This is a function docstring.'
u
'This is a function docstring.'
>>> C.__doc__
>>> C.__doc__
'This is a class docstring.'
u
'This is a class docstring.'
>>> CS.__doc__
>>> CS.__doc__
'This is a subclass docstring.'
u
'This is a subclass docstring.'
>>> print
CSS.__doc__
>>> print
(CSS.__doc__)
None
None
>>> T.__doc__
>>> T.__doc__
'This is an extension type docstring.'
u
'This is an extension type docstring.'
>>> TS.__doc__
>>> TS.__doc__
'This is an extension subtype docstring.'
u
'This is an extension subtype docstring.'
>>> TSS.__doc__
>>> TSS.__doc__
Compare with standard Python:
Compare with standard Python:
...
@@ -20,7 +20,7 @@ Compare with standard Python:
...
@@ -20,7 +20,7 @@ Compare with standard Python:
>>> def f():
>>> def f():
... 'This is a function docstring.'
... 'This is a function docstring.'
>>> f.__doc__
>>> f.__doc__
'This is a function docstring.'
u
'This is a function docstring.'
>>> class C:
>>> class C:
... 'This is a class docstring.'
... 'This is a class docstring.'
...
@@ -30,29 +30,33 @@ Compare with standard Python:
...
@@ -30,29 +30,33 @@ Compare with standard Python:
... pass
... pass
>>> C.__doc__
>>> C.__doc__
'This is a class docstring.'
u
'This is a class docstring.'
>>> CS.__doc__
>>> CS.__doc__
'This is a subclass docstring.'
u
'This is a subclass docstring.'
>>> CSS.__doc__
>>> CSS.__doc__
"""
"""
import
sys
if
sys
.
version_info
[
0
]
>=
3
:
__doc__
=
__doc__
.
replace
(
u" u'"
,
u" '"
)
def
f
():
def
f
():
"This is a function docstring."
u
"This is a function docstring."
class
C
:
class
C
:
"This is a class docstring."
u
"This is a class docstring."
class
CS
(
C
):
class
CS
(
C
):
"This is a subclass docstring."
u
"This is a subclass docstring."
class
CSS
(
CS
):
class
CSS
(
CS
):
pass
pass
cdef
class
T
:
cdef
class
T
:
"This is an extension type docstring."
u
"This is an extension type docstring."
cdef
class
TS
(
T
):
cdef
class
TS
(
T
):
"This is an extension subtype docstring."
u
"This is an extension subtype docstring."
cdef
class
TSS
(
TS
):
cdef
class
TSS
(
TS
):
pass
pass
tests/run/r_extcomplex2.pyx
View file @
481d7bec
__doc__
=
u"""
__doc__
=
u"""
>>> c = eggs()
>>> c = eggs()
>>>
print "eggs returned:",
c
>>> c
eggs returned:
(17+42j)
(17+42j)
>>> spam(c)
>>> spam(c)
Real: 17.0
Real: 17.0
Imag: 42.0
Imag: 42.0
...
...
tests/run/r_huss3.pyx
View file @
481d7bec
...
@@ -10,6 +10,10 @@ ValueError:
...
@@ -10,6 +10,10 @@ ValueError:
... print "%s: %s" % (e.__class__.__name__, e)
... print "%s: %s" % (e.__class__.__name__, e)
"""
"""
import
sys
if
sys
.
version_info
[
0
]
>=
3
:
__doc__
=
__doc__
.
replace
(
u"Exception, e'"
,
u"Exception as e"
)
def
bar
():
def
bar
():
try
:
try
:
raise
TypeError
raise
TypeError
...
...
tests/run/r_mitch_chapman_2.pyx
View file @
481d7bec
__doc__
=
u"""
__doc__
=
u"""
>>> boolExpressionsFail()
>>> boolExpressionsFail()
'Not 2b'
u
'Not 2b'
"""
"""
import
sys
if
sys
.
version_info
[
0
]
>=
3
:
__doc__
=
__doc__
.
replace
(
u" u'"
,
u" '"
)
def
boolExpressionsFail
():
def
boolExpressionsFail
():
dict
=
{
1
:
1
}
dict
=
{
1
:
1
}
if
not
dict
.
has_key
(
"2b"
)
:
if
not
"2b"
in
dict
:
return
"Not 2b"
return
u
"Not 2b"
else
:
else
:
return
"2b?"
return
u
"2b?"
tests/run/r_primes.pyx
View file @
481d7bec
__doc__
=
u"""
__doc__
=
u"""
>>> pri
nt pri
mes(20)
>>> primes(20)
[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71]
[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71]
"""
"""
...
...
tests/run/r_pythonapi.pyx
View file @
481d7bec
__doc__
=
u"""
__doc__
=
u"""
>>> x = spam()
>>> x = spam()
>>> print
repr(x
)
>>> print
(repr(x)
)
'Ftang
\
\
x00Ftang!'
b
'Ftang
\
\
x00Ftang!'
"""
"""
import
sys
if
sys
.
version_info
[
0
]
<
3
:
__doc__
=
__doc__
.
replace
(
u" b'"
,
u" '"
)
cdef
extern
from
"string.h"
:
cdef
extern
from
"string.h"
:
void
memcpy
(
char
*
d
,
char
*
s
,
int
n
)
void
memcpy
(
char
*
d
,
char
*
s
,
int
n
)
...
...
tests/run/r_spamtype.pyx
View file @
481d7bec
__doc__
=
u"""
__doc__
=
u"""
>>> s = Spam()
>>> s = Spam()
>>>
print
s.get_tons()
>>> s.get_tons()
17
17
>>> s.set_tons(42)
>>> s.set_tons(42)
>>>
print
s.get_tons()
>>> s.get_tons()
42
42
>>> s = None
>>> s = None
42 tons of spam is history.
42 tons of spam is history.
...
...
tests/run/r_vree_1.pyx
View file @
481d7bec
__doc__
=
u"""
__doc__
=
"""# disabled in Py3
>>> test(0)
>>> test(0)
0L
0L
>>> test(1)
>>> test(1)
...
...
tests/run/simpcall.pyx
View file @
481d7bec
__doc__
=
u"""
__doc__
=
u"""
>>> z(1,9.2,'test')
>>> z(1,9.2,
b
'test')
>>> failtype()
>>> failtype()
Traceback (most recent call last):
Traceback (most recent call last):
TypeError: an integer is required
TypeError: an integer is required
...
@@ -13,6 +13,10 @@ __doc__ = u"""
...
@@ -13,6 +13,10 @@ __doc__ = u"""
TypeError: function takes exactly 2 arguments (1 given)
TypeError: function takes exactly 2 arguments (1 given)
"""
"""
import
sys
if
sys
.
version_info
[
0
]
<
3
:
__doc__
=
__doc__
.
replace
(
u" b'"
,
u" '"
)
def
f
(
x
,
y
):
def
f
(
x
,
y
):
x
=
y
x
=
y
...
...
tests/run/slice3.pyx
View file @
481d7bec
__doc__
=
u"""
__doc__
=
u"""
>>> class Test(object):
>>> class Test(object):
... def __setitem__(self, key, value):
... def __setitem__(self, key, value):
... print
key, value
... print
((key, value))
... def __getitem__(self, key):
... def __getitem__(self, key):
... print
key
... print
(key)
... return self
... return self
>>> ellipsis(Test())
>>> ellipsis(Test())
...
@@ -23,7 +23,7 @@ __doc__ = u"""
...
@@ -23,7 +23,7 @@ __doc__ = u"""
slice(1, 2, 3)
slice(1, 2, 3)
>>> set(Test(), -11)
>>> set(Test(), -11)
slice(1, 2, 3) -11
(slice(1, 2, 3), -11)
"""
"""
def
ellipsis
(
o
):
def
ellipsis
(
o
):
...
...
tests/run/starargs.pyx
View file @
481d7bec
...
@@ -85,7 +85,7 @@ __doc__ = u"""
...
@@ -85,7 +85,7 @@ __doc__ = u"""
"""
"""
cdef
sorteditems
(
d
):
cdef
sorteditems
(
d
):
l
=
d
.
items
(
)
l
=
list
(
d
.
items
()
)
l
.
sort
()
l
.
sort
()
return
tuple
(
l
)
return
tuple
(
l
)
...
...
tests/run/strconstinclass.pyx
View file @
481d7bec
__doc__
=
u"""
__doc__
=
u"""
>>> c = C()
>>> c = C()
>>> print
c.x
>>> print
(c.x)
foo
foo
"""
"""
...
...
tests/run/strfunction.pyx
View file @
481d7bec
__doc__
=
u"""
__doc__
=
u"""
>>> s('test')
>>> s('test'
, **encoding
)
'test'
b
'test'
>>> z
>>> z
'test'
b
'test'
>>> c('testing')
>>> c('testing')
'testing'
b
'testing'
>>> sub('testing a subtype')
>>> sub('testing a subtype')
'testing a subtype'
b
'testing a subtype'
>>> subs('testing a subtype')
>>> subs('testing a subtype'
, **encoding
)
'testing a subtype'
b
'testing a subtype'
# >>> csub('testing a subtype')
# >>> csub('testing a subtype')
# 'testing a subtype'
# 'testing a subtype'
...
@@ -21,6 +21,7 @@ if sys.version_info[0] >= 3:
...
@@ -21,6 +21,7 @@ if sys.version_info[0] >= 3:
encoding
=
{
'encoding'
:
'ASCII'
}
encoding
=
{
'encoding'
:
'ASCII'
}
else
:
else
:
encoding
=
{}
encoding
=
{}
__doc__
=
__doc__
.
replace
(
u" b'"
,
u" '"
)
s
=
str
s
=
str
z
=
str
(
'test'
,
**
encoding
)
z
=
str
(
'test'
,
**
encoding
)
...
...
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