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
Gwenaël Samain
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
():
"""
>>> for_else()
30
>>> print(
u'*'.join(int_comp()
) )
>>> print(
int_comp(
) )
00*01*02
"""
cdef
int
i
,
j
=
0
,
k
=
2
...
...
@@ -18,5 +15,5 @@ def for_else():
def
int_comp
():
cdef
int
i
return
tuple
([
u"%02d"
%
i
for
i
from
0
<=
i
<
3
]
)
return
u'*'
.
join
(
tuple
([
u"%02d"
%
i
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
if
sys
.
version_info
[
0
]
>=
3
:
__doc__
=
__doc__
.
replace
(
u'is unsubscriptable'
,
u'is not subscriptable'
)
elif
sys
.
version_info
<
(
2
,
5
):
__doc__
=
__doc__
.
replace
(
u"'int' object is unsubscriptable"
,
u'unsubscriptable object'
)
def
index_tuple
(
tuple
t
,
int
i
):
"""
>>> index_tuple((1,1,2,3,5), 0)
...
...
@@ -52,10 +60,6 @@ def index_object(object o, int i):
Traceback (most recent call last):
...
IndexError: string index out of range
>>> index_object(100, 100)
Traceback (most recent call last):
...
TypeError: 'int' object is unsubscriptable
"""
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
if
sys
.
version_info
[
0
]
>=
3
:
__doc__
=
__doc__
.
replace
(
u'L'
,
u''
)
def
c_longs
():
"""
>>> c_longs()
(1, 1L, -1L, 18446744073709551615L)
"""
cdef
long
a
=
1L
cdef
unsigned
long
ua
=
1
UL
cdef
long
long
aa
=
0xFFFFFFFFFFFFFFFF
LL
...
...
@@ -16,8 +24,4 @@ def c_longs():
return
a
,
ua
,
aa
,
uaa
def
py_longs
():
"""
>>> py_longs()
(1, 1L, 100000000000000000000000000000000L, -100000000000000000000000000000000L)
"""
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
:
"""
...
...
@@ -10,8 +7,8 @@ class C:
u'a b'
>>> C().xxx(42)
42
>>> C().xxx()
u'a b'
>>> C().xxx()
== 'a b'
True
"""
def
xxx
(
self
,
p
=
u"a b"
):
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
():
"""
>>> f()
>>> g
42
>>> x
u'spam'
>>> y
u'eggs'
>>> z
u'spameggs'
>>> x
== 'spam'
True
>>> y
== 'eggs'
True
>>> z
== 'spameggs'
True
"""
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
def
test
(
obj
):
"""
>>> test(Exception(
u
'hi'))
Raising: Exception(
u
'hi',)
Caught: Exception(
u
'hi',)
>>> test(Exception('hi'))
Raising: Exception('hi',)
Caught: Exception('hi',)
"""
print
u"Raising: %s%r"
%
(
obj
.
__class__
.
__name__
,
obj
.
args
)
try
:
...
...
tests/run/r_bowden1.pyx
View file @
6787f000
__doc__
=
u"""
>>> f(100)
101L
>>> g(3000000000)
3000000001L
"""
import
sys
if
sys
.
version_info
[
0
]
>=
3
:
__doc__
=
__doc__
.
replace
(
u"L"
,
u""
)
def
f
(
x
):
"""
>>> f(100)
101L
"""
cdef
unsigned
long
long
ull
ull
=
x
return
ull
+
1
def
g
(
unsigned
long
x
):
"""
>>> g(3000000000)
3000000001L
"""
return
x
+
1
tests/run/typedfieldbug_T303.pyx
View file @
6787f000
__doc__
=
"""
>>> readonly()
Traceback (most recent call last):
...
TypeError: readonly attribute
"""
import
sys
if
sys
.
version_info
[
0
]
>=
3
:
__doc__
=
__doc__
.
replace
(
u'TypeError:'
,
u'AttributeError:'
)
...
...
@@ -53,11 +60,5 @@ def longdouble_access():
def
readonly
():
"""
>>> readonly()
Traceback (most recent call last):
...
TypeError: readonly attribute
"""
c
=
MyClass
()
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