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
0427dd3d
Commit
0427dd3d
authored
May 15, 2008
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more test fixes for Py3
parent
4257453b
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
90 additions
and
62 deletions
+90
-62
tests/run/attr.pyx
tests/run/attr.pyx
+24
-24
tests/run/cintop.pyx
tests/run/cintop.pyx
+1
-1
tests/run/classpass.pyx
tests/run/classpass.pyx
+4
-4
tests/run/concatcstrings.pyx
tests/run/concatcstrings.pyx
+6
-2
tests/run/ct_DEF.pyx
tests/run/ct_DEF.pyx
+11
-3
tests/run/extclasspass.pyx
tests/run/extclasspass.pyx
+2
-2
tests/run/extinstantiate.pyx
tests/run/extinstantiate.pyx
+2
-2
tests/run/ishimoto2.pyx
tests/run/ishimoto2.pyx
+7
-3
tests/run/jarausch1.pyx
tests/run/jarausch1.pyx
+6
-2
tests/run/new_style_exceptions.pyx
tests/run/new_style_exceptions.pyx
+9
-5
tests/run/pynumop.pyx
tests/run/pynumop.pyx
+4
-4
tests/run/r_addint.pyx
tests/run/r_addint.pyx
+2
-2
tests/run/r_barbieri1.pyx
tests/run/r_barbieri1.pyx
+2
-2
tests/run/r_hordijk1.pyx
tests/run/r_hordijk1.pyx
+6
-2
tests/run/r_huss3.pyx
tests/run/r_huss3.pyx
+2
-2
tests/run/r_toofewargs.pyx
tests/run/r_toofewargs.pyx
+2
-2
No files found.
tests/run/attr.pyx
View file @
0427dd3d
__doc__
=
u"""
>>> class Test:
>>> class Test
(object)
:
... def __init__(self, i):
... self.i = i
>>> b = Test(1)
...
...
@@ -9,50 +9,50 @@ __doc__ = u"""
>>> b.spam.eggs.spam.eggs = Test(5)
>>> a = f(b)
>>>
print
a.i
>>> a.i
2
>>>
print
b.i
>>> b.i
1
>>>
print
a.spam.i
>>> a.spam.i
1
>>>
print
b.spam.i
>>> b.spam.i
2
>>>
print
a.spam.eggs.i
>>> a.spam.eggs.i
Traceback (most recent call last):
AttributeError:
Test instance
has no attribute 'eggs'
>>>
print
b.spam.eggs.i
AttributeError:
'Test' object
has no attribute 'eggs'
>>> b.spam.eggs.i
3
>>>
print
a.spam.spam.i
>>> a.spam.spam.i
2
>>>
print
b.spam.spam.i
>>> b.spam.spam.i
1
>>>
print
a.spam.eggs.spam.i
>>> a.spam.eggs.spam.i
Traceback (most recent call last):
AttributeError:
Test instance
has no attribute 'eggs'
>>>
print
b.spam.eggs.spam.i
AttributeError:
'Test' object
has no attribute 'eggs'
>>> b.spam.eggs.spam.i
4
>>> a = g(b)
>>>
print
a.i
>>> a.i
3
>>>
print
b.i
>>> b.i
1
>>>
print
a.spam.i
>>> a.spam.i
4
>>>
print
b.spam.i
>>> b.spam.i
2
>>>
print
a.spam.eggs.i
>>> a.spam.eggs.i
1
>>>
print
b.spam.eggs.i
>>> b.spam.eggs.i
3
>>>
print
a.spam.spam.i
>>> a.spam.spam.i
Traceback (most recent call last):
AttributeError:
Test instance
has no attribute 'spam'
>>>
print
b.spam.spam.i
AttributeError:
'Test' object
has no attribute 'spam'
>>> b.spam.spam.i
1
>>>
print
a.spam.eggs.spam.i
>>> a.spam.eggs.spam.i
2
>>>
print
b.spam.eggs.spam.i
>>> b.spam.eggs.spam.i
4
"""
...
...
tests/run/cintop.pyx
View file @
0427dd3d
...
...
@@ -10,7 +10,7 @@ __doc__ = u"""
>>> int1 ^= int2 >> int3
>>> int1 ^= int2 << int3 | int2 >> int3
>>> long1 = char1 | int1
>>>
print
(int1, long1) == f()
>>> (int1, long1) == f()
True
>>> f()
...
...
tests/run/classpass.pyx
View file @
0427dd3d
__doc__
=
u"""
>>> s = Spam()
>>>
print
s.__class__.__name__
Spam
>>> s.__class__.__name__
'Spam'
>>> s = SpamT()
>>>
print
type(s).__name__
SpamT
>>> type(s).__name__
'SpamT'
"""
class
Spam
:
pass
...
...
tests/run/concatcstrings.pyx
View file @
0427dd3d
__doc__
=
u"""
>>> spam ==
"C string 1" + "C string 2"
>>> spam ==
u'C string 1' + u'C string 2'
True
"""
spam
=
"C string 1"
+
"C string 2"
import
sys
if
sys
.
version_info
[
0
]
>=
3
:
__doc__
=
__doc__
.
replace
(
u" u'"
,
u" '"
)
spam
=
u"C string 1"
+
u"C string 2"
tests/run/ct_DEF.pyx
View file @
0427dd3d
...
...
@@ -16,7 +16,7 @@ __doc__ = u"""
>>> f()
12.5
>>> s()
'spam'
u
'spam'
>>> two()
2
>>> five()
...
...
@@ -27,7 +27,15 @@ __doc__ = u"""
False
"""
DEF
TUPLE
=
(
1
,
2
,
"buckle my shoe"
)
import
sys
if
sys
.
version_info
[
0
]
>=
3
:
__doc__
=
__doc__
.
replace
(
u" u'"
,
u" '"
)
import
sys
if
sys
.
version_info
[
0
]
>=
3
:
__doc__
=
__doc__
.
replace
(
u" 042"
,
u" 0o42"
)
DEF
TUPLE
=
(
1
,
2
,
u"buckle my shoe"
)
DEF
TRUE_FALSE
=
(
True
,
False
)
DEF
CHAR
=
c
'x'
...
...
@@ -38,7 +46,7 @@ DEF INT3 = 042
DEF
INT4
=
-
0x42
DEF
LONG
=
666L
DEF
FLOAT
=
12.5
DEF
STR
=
"spam"
DEF
STR
=
u
"spam"
DEF
TWO
=
TUPLE
[
1
]
DEF
FIVE
=
TWO
+
3
DEF
TRUE
=
TRUE_FALSE
[
0
]
...
...
tests/run/extclasspass.pyx
View file @
0427dd3d
__doc__
=
u"""
>>> e = Eggs()
>>>
print
type(e).__name__
Eggs
>>> type(e).__name__
'Eggs'
"""
cdef
class
Eggs
:
pass
tests/run/extinstantiate.pyx
View file @
0427dd3d
__doc__
=
u"""
>>>
print
type(f()).__name__
Spam
>>> type(f()).__name__
'Spam'
"""
cdef
class
Spam
:
...
...
tests/run/ishimoto2.pyx
View file @
0427dd3d
...
...
@@ -2,13 +2,17 @@ __doc__ = u"""
>>> C().xxx(5)
5
>>> C().xxx()
'a b'
u
'a b'
>>> C().xxx(42)
42
>>> C().xxx()
'a b'
u
'a b'
"""
import
sys
if
sys
.
version_info
[
0
]
>=
3
:
__doc__
=
__doc__
.
replace
(
u" u'"
,
u" '"
)
class
C
:
def
xxx
(
self
,
p
=
"a b"
):
def
xxx
(
self
,
p
=
u
"a b"
):
return
p
tests/run/jarausch1.pyx
View file @
0427dd3d
__doc__
=
u"""
>>> py_x = r'
\
\
\
\
'
>>> py_x =
u
r'
\
\
\
\
'
>>> assert x == py_x
"""
x
=
r'\\'
import
sys
if
sys
.
version_info
[
0
]
>=
3
:
__doc__
=
__doc__
.
replace
(
u" ur'"
,
u" r'"
)
x
=
ur'\\'
tests/run/new_style_exceptions.pyx
View file @
0427dd3d
__doc__
=
u"""
>>> test(Exception('hi'))
Raising: Exception('hi',)
Caught: Exception('hi',)
>>> test(Exception(
u
'hi'))
Raising: Exception(
u
'hi',)
Caught: Exception(
u
'hi',)
"""
import
sys
if
sys
.
version_info
[
0
]
>=
3
:
__doc__
=
__doc__
.
replace
(
u"u'"
,
u"'"
)
import
sys
,
types
def
test
(
obj
):
print
"Raising: %s%r"
%
(
obj
.
__class__
.
__name__
,
obj
.
args
)
print
u
"Raising: %s%r"
%
(
obj
.
__class__
.
__name__
,
obj
.
args
)
try
:
raise
obj
except
:
...
...
@@ -16,4 +20,4 @@ def test(obj):
assert
isinstance
(
info
[
0
],
type
)
else
:
assert
isinstance
(
info
[
0
],
types
.
ClassType
)
print
"Caught: %s%r"
%
(
info
[
1
].
__class__
.
__name__
,
info
[
1
].
args
)
print
u
"Caught: %s%r"
%
(
info
[
1
].
__class__
.
__name__
,
info
[
1
].
args
)
tests/run/pynumop.pyx
View file @
0427dd3d
...
...
@@ -2,7 +2,7 @@ __doc__ = u"""
>>> f()
6
>>> g()
0
2
"""
def
f
():
...
...
@@ -13,8 +13,8 @@ def f():
return
obj1
def
g
():
obj1
=
1
obj2
=
2
obj1
=
1
2
obj2
=
6
obj3
=
3
obj1
=
obj2
/
obj3
return
obj1
return
int
(
obj1
)
tests/run/r_addint.pyx
View file @
0427dd3d
...
...
@@ -6,13 +6,13 @@ __doc__ = u"""
(1, 2, 3)
>>> [ str(f) for f in test(17.3, 88.6) ]
['17.3', '88.6', '105.9']
>>> test(u
"eggs", u"spam"
)
>>> test(u
'eggs', u'spam'
)
(u'eggs', u'spam', u'eggsspam')
"""
import
sys
if
sys
.
version_info
[
0
]
>=
3
:
__doc__
=
__doc__
.
replace
(
u"
u'"
,
u"
'"
)
__doc__
=
__doc__
.
replace
(
u"
u'"
,
u"
'"
)
def
add
(
x
,
y
):
return
x
+
y
tests/run/r_barbieri1.pyx
View file @
0427dd3d
...
...
@@ -2,7 +2,7 @@ __doc__ = u"""
>>> try:
... B()
... except Exception, e:
... print
"%s: %s" % (e.__class__.__name__, e
)
... print
("%s: %s" % (e.__class__.__name__, e)
)
Exception: crash-me
"""
...
...
@@ -12,7 +12,7 @@ if sys.version_info[0] >= 3:
cdef
class
A
:
def
__cinit__
(
self
):
raise
Exception
(
"crash-me"
)
raise
Exception
(
u
"crash-me"
)
cdef
class
B
(
A
):
def
__cinit__
(
self
):
...
...
tests/run/r_hordijk1.pyx
View file @
0427dd3d
...
...
@@ -2,12 +2,16 @@ __doc__ = u"""
>>> try:
... s = Spam()
... except StandardError, e:
... print
"Exception:", e
... print
("Exception: %s" % e)
... else:
... print
"Did not raise the expected exception"
... print
("Did not raise the expected exception")
Exception: This is not a spanish inquisition
"""
import
sys
if
sys
.
version_info
[
0
]
>=
3
:
__doc__
=
__doc__
.
replace
(
u"Exception, e"
,
u"Exception as e"
)
cdef
extern
from
"Python.h"
:
ctypedef
class
types
.
ListType
[
object
PyListObject
]:
pass
...
...
tests/run/r_huss3.pyx
View file @
0427dd3d
...
...
@@ -2,12 +2,12 @@ __doc__ = u"""
>>> try:
... foo()
... except Exception, e:
... print
"%s: %s" % (e.__class__.__name__, e
)
... print
("%s: %s" % (e.__class__.__name__, e)
)
ValueError:
>>> try:
... bar()
... except Exception, e:
... print
"%s: %s" % (e.__class__.__name__, e
)
... print
("%s: %s" % (e.__class__.__name__, e)
)
"""
import
sys
...
...
tests/run/r_toofewargs.pyx
View file @
0427dd3d
__doc__
=
u"""
>>> s = Spam()
>>> s = Spam()
#doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: function takes exactly 3 arguments (0 given)
"""
import
sys
,
re
if
sys
.
version_info
[
0
]
>=
3
:
__doc__
=
re
.
sub
(
u"Error:
(.*)exactly(.*)"
,
u"Error:
\
\
1at most
\
\
2
"
,
__doc__
)
__doc__
=
re
.
sub
(
u"Error:
.*"
,
u"Error: ...
"
,
__doc__
)
cdef
class
Spam
:
...
...
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