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
fdcaa814
Commit
fdcaa814
authored
16 years ago
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more test fixes for Py3
parent
3588f89c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
39 deletions
+47
-39
tests/run/extstarargs.pyx
tests/run/extstarargs.pyx
+18
-14
tests/run/r_addint.pyx
tests/run/r_addint.pyx
+2
-2
tests/run/r_docstrings.pyx
tests/run/r_docstrings.pyx
+10
-10
tests/run/starargs.pyx
tests/run/starargs.pyx
+17
-13
No files found.
tests/run/extstarargs.pyx
View file @
fdcaa814
...
...
@@ -5,13 +5,13 @@ __doc__ = u"""
>>> spam(1,2,3)
(1, 2, 3)
>>> spam(1,2)
>>> spam(1,2)
#doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: function takes exactly 3 arguments (2 given)
>>> spam(1,2,3,4)
>>> spam(1,2,3,4)
#doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: function takes exactly 3 arguments (4 given)
>>> spam(1,2,3, a=1)
>>> spam(1,2,3, a=1)
#doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: 'a' is an invalid keyword argument for this function
...
...
@@ -21,21 +21,21 @@ __doc__ = u"""
(1, 2, 3, (4,))
>>> grail(1,2,3,4,5,6,7,8,9)
(1, 2, 3, (4, 5, 6, 7, 8, 9))
>>> grail(1,2)
>>> grail(1,2)
#doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: function takes exactly 3 arguments (2 given)
>>> grail(1,2,3, a=1)
>>> grail(1,2,3, a=1)
#doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: 'a' is an invalid keyword argument for this function
>>> swallow(1,2,3)
(1, 2, 3, ())
>>> swallow(1,2,3,4)
>>> swallow(1,2,3,4)
#doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: function takes at most 3 positional arguments (4 given)
>>> swallow(1,2,3, a=1, b=2)
(1, 2, 3, (('a', 1), ('b', 2)))
>>> swallow(1,2,3, x=1)
>>> swallow(1,2,3, x=1)
#doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: keyword parameter 'x' was given by position and by name
...
...
@@ -47,7 +47,7 @@ __doc__ = u"""
(1, 2, 3, (), (('a', 1),))
>>> creosote(1,2,3,4, a=1, b=2)
(1, 2, 3, (4,), (('a', 1), ('b', 2)))
>>> creosote(1,2,3,4, x=1)
>>> creosote(1,2,3,4, x=1)
#doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: keyword parameter 'x' was given by position and by name
...
...
@@ -55,10 +55,10 @@ __doc__ = u"""
(1,)
>>> onlyt(1,2)
(1, 2)
>>> onlyt(a=1)
>>> onlyt(a=1)
#doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: 'a' is an invalid keyword argument for this function
>>> onlyt(1, a=2)
>>> onlyt(1, a=2)
#doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: 'a' is an invalid keyword argument for this function
...
...
@@ -66,13 +66,13 @@ __doc__ = u"""
(('a', 1),)
>>> onlyk(a=1, b=2)
(('a', 1), ('b', 2))
>>> onlyk(1)
>>> onlyk(1)
#doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: function takes at most 0 positional arguments (1 given)
>>> onlyk(1, 2)
>>> onlyk(1, 2)
#doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: function takes at most 0 positional arguments (2 given)
>>> onlyk(1, a=1, b=2)
>>> onlyk(1, a=1, b=2)
#doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: function takes at most 0 positional arguments (1 given)
...
...
@@ -88,8 +88,12 @@ __doc__ = u"""
(1, ('a', 1), ('b', 2))
"""
import
sys
,
re
if
sys
.
version_info
[
0
]
>=
3
:
__doc__
=
re
.
sub
(
u"Error: (.*)"
,
u"Error: ..."
,
__doc__
)
cdef
sorteditems
(
d
):
l
=
d
.
items
(
)
l
=
list
(
d
.
items
()
)
l
.
sort
()
return
tuple
(
l
)
...
...
This diff is collapsed.
Click to expand it.
tests/run/r_addint.pyx
View file @
fdcaa814
...
...
@@ -4,8 +4,8 @@ __doc__ = u"""
>>> test(1, 2)
(1, 2, 3)
>>>
test(17.3, 88.6)
(17.3, 88.6, 105.9)
>>>
[ repr(f) for f in test(17.3, 88.6) ]
[17.3, 88.6, 105.9]
>>> test(u"eggs", u"spam")
(u'eggs', u'spam', u'eggsspam')
"""
...
...
This diff is collapsed.
Click to expand it.
tests/run/r_docstrings.pyx
View file @
fdcaa814
...
...
@@ -3,36 +3,36 @@ __doc__ = u"""
u'This is a function docstring.'
>>> C.__doc__
'This is a class docstring.'
u
'This is a class docstring.'
>>> CS.__doc__
'This is a subclass docstring.'
u
'This is a subclass docstring.'
>>> print(CSS.__doc__)
None
>>> T.__doc__
'This is an extension type docstring.'
u
'This is an extension type docstring.'
>>> TS.__doc__
'This is an extension subtype docstring.'
u
'This is an extension subtype docstring.'
>>> TSS.__doc__
Compare with standard Python:
>>> def f():
... 'This is a function docstring.'
...
u
'This is a function docstring.'
>>> f.__doc__
'This is a function docstring.'
u
'This is a function docstring.'
>>> class C:
... 'This is a class docstring.'
...
u
'This is a class docstring.'
>>> class CS(C):
... 'This is a subclass docstring.'
...
u
'This is a subclass docstring.'
>>> class CSS(CS):
... pass
>>> C.__doc__
'This is a class docstring.'
u
'This is a class docstring.'
>>> CS.__doc__
'This is a subclass docstring.'
u
'This is a subclass docstring.'
>>> CSS.__doc__
"""
...
...
This diff is collapsed.
Click to expand it.
tests/run/starargs.pyx
View file @
fdcaa814
__doc__
=
u"""
>>> spam(1,2,3)
(1, 2, 3)
>>> spam(1,2)
>>> spam(1,2)
#doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: function takes exactly 3 arguments (2 given)
>>> spam(1,2,3,4)
>>> spam(1,2,3,4)
#doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: function takes exactly 3 arguments (4 given)
>>> spam(1,2,3, a=1)
>>> spam(1,2,3, a=1)
#doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: 'a' is an invalid keyword argument for this function
...
...
@@ -17,21 +17,21 @@ __doc__ = u"""
(1, 2, 3, (4,))
>>> grail(1,2,3,4,5,6,7,8,9)
(1, 2, 3, (4, 5, 6, 7, 8, 9))
>>> grail(1,2)
>>> grail(1,2)
#doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: function takes exactly 3 arguments (2 given)
>>> grail(1,2,3, a=1)
>>> grail(1,2,3, a=1)
#doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: 'a' is an invalid keyword argument for this function
>>> swallow(1,2,3)
(1, 2, 3, ())
>>> swallow(1,2,3,4)
>>> swallow(1,2,3,4)
#doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: function takes at most 3 positional arguments (4 given)
>>> swallow(1,2,3, a=1, b=2)
(1, 2, 3, (('a', 1), ('b', 2)))
>>> swallow(1,2,3, x=1)
>>> swallow(1,2,3, x=1)
#doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: keyword parameter 'x' was given by position and by name
...
...
@@ -43,7 +43,7 @@ __doc__ = u"""
(1, 2, 3, (), (('a', 1),))
>>> creosote(1,2,3,4, a=1, b=2)
(1, 2, 3, (4,), (('a', 1), ('b', 2)))
>>> creosote(1,2,3,4, x=1)
>>> creosote(1,2,3,4, x=1)
#doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: keyword parameter 'x' was given by position and by name
...
...
@@ -51,10 +51,10 @@ __doc__ = u"""
(1,)
>>> onlyt(1,2)
(1, 2)
>>> onlyt(a=1)
>>> onlyt(a=1)
#doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: 'a' is an invalid keyword argument for this function
>>> onlyt(1, a=2)
>>> onlyt(1, a=2)
#doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: 'a' is an invalid keyword argument for this function
...
...
@@ -62,13 +62,13 @@ __doc__ = u"""
(('a', 1),)
>>> onlyk(a=1, b=2)
(('a', 1), ('b', 2))
>>> onlyk(1)
>>> onlyk(1)
#doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: function takes at most 0 positional arguments (1 given)
>>> onlyk(1, 2)
>>> onlyk(1, 2)
#doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: function takes at most 0 positional arguments (2 given)
>>> onlyk(1, a=1, b=2)
>>> onlyk(1, a=1, b=2)
#doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: function takes at most 0 positional arguments (1 given)
...
...
@@ -84,6 +84,10 @@ __doc__ = u"""
(1, ('a', 1), ('b', 2))
"""
import
sys
,
re
if
sys
.
version_info
[
0
]
>=
3
:
__doc__
=
re
.
sub
(
u"Error: (.*)"
,
u"Error: ..."
,
__doc__
)
cdef
sorteditems
(
d
):
l
=
list
(
d
.
items
())
l
.
sort
()
...
...
This diff is collapsed.
Click to expand it.
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