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
6787f000
Commit
6787f000
authored
Oct 30, 2009
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
various Py3 test fixes after doctest refactoring
parent
d0d88e68
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
48 additions
and
52 deletions
+48
-52
tests/run/forfrom.pyx
tests/run/forfrom.pyx
+3
-6
tests/run/index.pyx
tests/run/index.pyx
+8
-4
tests/run/int_literals.pyx
tests/run/int_literals.pyx
+12
-8
tests/run/ishimoto2.pyx
tests/run/ishimoto2.pyx
+2
-5
tests/run/modbody.pyx
tests/run/modbody.pyx
+6
-9
tests/run/new_style_exceptions.pyx
tests/run/new_style_exceptions.pyx
+3
-6
tests/run/r_bowden1.pyx
tests/run/r_bowden1.pyx
+7
-8
tests/run/typedfieldbug_T303.pyx
tests/run/typedfieldbug_T303.pyx
+7
-6
No files found.
tests/run/forfrom.pyx
View file @
6787f000
import
sys
if
sys
.
version_info
[
0
]
>=
3
:
__doc__
=
__doc__
.
replace
(
u" u'"
,
u" '"
).
replace
(
u' u"'
,
u' "'
)
def
for_else
():
def
for_else
():
"""
"""
>>> for_else()
>>> for_else()
30
30
>>> print(
u'*'.join(int_comp()
) )
>>> print(
int_comp(
) )
00*01*02
00*01*02
"""
"""
cdef
int
i
,
j
=
0
,
k
=
2
cdef
int
i
,
j
=
0
,
k
=
2
...
@@ -18,5 +15,5 @@ def for_else():
...
@@ -18,5 +15,5 @@ def for_else():
def
int_comp
():
def
int_comp
():
cdef
int
i
cdef
int
i
return
tuple
([
u"%02d"
%
i
return
u'*'
.
join
(
tuple
([
u"%02d"
%
i
for
i
from
0
<=
i
<
3
]
)
for
i
from
0
<=
i
<
3
])
)
tests/run/index.pyx
View file @
6787f000
__doc__
=
u"""
>>> index_object(100, 100)
Traceback (most recent call last):
...
TypeError: 'int' object is unsubscriptable
"""
import
sys
import
sys
if
sys
.
version_info
[
0
]
>=
3
:
if
sys
.
version_info
[
0
]
>=
3
:
__doc__
=
__doc__
.
replace
(
u'is unsubscriptable'
,
u'is not subscriptable'
)
__doc__
=
__doc__
.
replace
(
u'is unsubscriptable'
,
u'is not subscriptable'
)
elif
sys
.
version_info
<
(
2
,
5
):
elif
sys
.
version_info
<
(
2
,
5
):
__doc__
=
__doc__
.
replace
(
u"'int' object is unsubscriptable"
,
u'unsubscriptable object'
)
__doc__
=
__doc__
.
replace
(
u"'int' object is unsubscriptable"
,
u'unsubscriptable object'
)
def
index_tuple
(
tuple
t
,
int
i
):
def
index_tuple
(
tuple
t
,
int
i
):
"""
"""
>>> index_tuple((1,1,2,3,5), 0)
>>> index_tuple((1,1,2,3,5), 0)
...
@@ -52,10 +60,6 @@ def index_object(object o, int i):
...
@@ -52,10 +60,6 @@ def index_object(object o, int i):
Traceback (most recent call last):
Traceback (most recent call last):
...
...
IndexError: string index out of range
IndexError: string index out of range
>>> index_object(100, 100)
Traceback (most recent call last):
...
TypeError: 'int' object is unsubscriptable
"""
"""
return
o
[
i
]
return
o
[
i
]
...
...
tests/run/int_literals.pyx
View file @
6787f000
__doc__
=
u"""
>>> c_longs()
(1, 1L, -1L, 18446744073709551615L)
>>> py_longs()
(1, 1L, 100000000000000000000000000000000L, -100000000000000000000000000000000L)
"""
import
sys
if
sys
.
version_info
[
0
]
>=
3
:
__doc__
=
__doc__
.
replace
(
u'L'
,
u''
)
import
sys
import
sys
if
sys
.
version_info
[
0
]
>=
3
:
if
sys
.
version_info
[
0
]
>=
3
:
__doc__
=
__doc__
.
replace
(
u'L'
,
u''
)
__doc__
=
__doc__
.
replace
(
u'L'
,
u''
)
def
c_longs
():
def
c_longs
():
"""
>>> c_longs()
(1, 1L, -1L, 18446744073709551615L)
"""
cdef
long
a
=
1L
cdef
long
a
=
1L
cdef
unsigned
long
ua
=
1
UL
cdef
unsigned
long
ua
=
1
UL
cdef
long
long
aa
=
0xFFFFFFFFFFFFFFFF
LL
cdef
long
long
aa
=
0xFFFFFFFFFFFFFFFF
LL
...
@@ -16,8 +24,4 @@ def c_longs():
...
@@ -16,8 +24,4 @@ def c_longs():
return
a
,
ua
,
aa
,
uaa
return
a
,
ua
,
aa
,
uaa
def
py_longs
():
def
py_longs
():
"""
>>> py_longs()
(1, 1L, 100000000000000000000000000000000L, -100000000000000000000000000000000L)
"""
return
1
,
1L
,
100000000000000000000000000000000
,
-
100000000000000000000000000000000
return
1
,
1L
,
100000000000000000000000000000000
,
-
100000000000000000000000000000000
tests/run/ishimoto2.pyx
View file @
6787f000
import
sys
if
sys
.
version_info
[
0
]
>=
3
:
__doc__
=
__doc__
.
replace
(
u" u'"
,
u" '"
)
class
C
:
class
C
:
"""
"""
...
@@ -10,8 +7,8 @@ class C:
...
@@ -10,8 +7,8 @@ class C:
u'a b'
u'a b'
>>> C().xxx(42)
>>> C().xxx(42)
42
42
>>> C().xxx()
>>> C().xxx()
== 'a b'
u'a b'
True
"""
"""
def
xxx
(
self
,
p
=
u"a b"
):
def
xxx
(
self
,
p
=
u"a b"
):
return
p
return
p
tests/run/modbody.pyx
View file @
6787f000
import
sys
if
sys
.
version_info
[
0
]
>=
3
:
__doc__
=
__doc__
.
replace
(
u" u'"
,
u" '"
)
def
f
():
def
f
():
"""
"""
>>> f()
>>> f()
>>> g
>>> g
42
42
>>> x
>>> x
== 'spam'
u'spam'
True
>>> y
>>> y
== 'eggs'
u'eggs'
True
>>> z
>>> z
== 'spameggs'
u'spameggs'
True
"""
"""
pass
pass
...
...
tests/run/new_style_exceptions.pyx
View file @
6787f000
import
sys
if
sys
.
version_info
[
0
]
>=
3
:
__doc__
=
__doc__
.
replace
(
u"u'"
,
u"'"
)
import
sys
,
types
import
sys
,
types
def
test
(
obj
):
def
test
(
obj
):
"""
"""
>>> test(Exception(
u
'hi'))
>>> test(Exception('hi'))
Raising: Exception(
u
'hi',)
Raising: Exception('hi',)
Caught: Exception(
u
'hi',)
Caught: Exception('hi',)
"""
"""
print
u"Raising: %s%r"
%
(
obj
.
__class__
.
__name__
,
obj
.
args
)
print
u"Raising: %s%r"
%
(
obj
.
__class__
.
__name__
,
obj
.
args
)
try
:
try
:
...
...
tests/run/r_bowden1.pyx
View file @
6787f000
__doc__
=
u"""
>>> f(100)
101L
>>> g(3000000000)
3000000001L
"""
import
sys
import
sys
if
sys
.
version_info
[
0
]
>=
3
:
if
sys
.
version_info
[
0
]
>=
3
:
__doc__
=
__doc__
.
replace
(
u"L"
,
u""
)
__doc__
=
__doc__
.
replace
(
u"L"
,
u""
)
def
f
(
x
):
def
f
(
x
):
"""
>>> f(100)
101L
"""
cdef
unsigned
long
long
ull
cdef
unsigned
long
long
ull
ull
=
x
ull
=
x
return
ull
+
1
return
ull
+
1
def
g
(
unsigned
long
x
):
def
g
(
unsigned
long
x
):
"""
>>> g(3000000000)
3000000001L
"""
return
x
+
1
return
x
+
1
tests/run/typedfieldbug_T303.pyx
View file @
6787f000
__doc__
=
"""
>>> readonly()
Traceback (most recent call last):
...
TypeError: readonly attribute
"""
import
sys
import
sys
if
sys
.
version_info
[
0
]
>=
3
:
if
sys
.
version_info
[
0
]
>=
3
:
__doc__
=
__doc__
.
replace
(
u'TypeError:'
,
u'AttributeError:'
)
__doc__
=
__doc__
.
replace
(
u'TypeError:'
,
u'AttributeError:'
)
...
@@ -53,11 +60,5 @@ def longdouble_access():
...
@@ -53,11 +60,5 @@ def longdouble_access():
def
readonly
():
def
readonly
():
"""
>>> readonly()
Traceback (most recent call last):
...
TypeError: readonly attribute
"""
c
=
MyClass
()
c
=
MyClass
()
c
.
actual_double
=
3
c
.
actual_double
=
3
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