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
4a009f36
Commit
4a009f36
authored
Feb 24, 2012
by
Vitja Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't rely on dict items order in doctests, use sorted() instead
parent
725c588d
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
28 additions
and
28 deletions
+28
-28
tests/run/dict.pyx
tests/run/dict.pyx
+4
-4
tests/run/exec_noargs.pyx
tests/run/exec_noargs.pyx
+2
-2
tests/run/metaclass.pyx
tests/run/metaclass.pyx
+2
-2
tests/run/r_extstarargs.pyx
tests/run/r_extstarargs.pyx
+6
-6
tests/run/r_starargs.pyx
tests/run/r_starargs.pyx
+6
-6
tests/run/rodriguez_1.pyx
tests/run/rodriguez_1.pyx
+2
-2
tests/run/struct_conversion.pyx
tests/run/struct_conversion.pyx
+6
-6
No files found.
tests/run/dict.pyx
View file @
4a009f36
...
...
@@ -16,16 +16,16 @@ def keyvalue(key, value):
def
keyvalues
(
key1
,
value1
,
key2
,
value2
):
"""
>>>
keyvalues(1, 2, 3, 4
)
{1: 2, 3: 4}
>>>
sorted(keyvalues(1, 2, 3, 4).items()
)
[(1, 2), (3, 4)]
"""
d
=
{
key1
:
value1
,
key2
:
value2
}
return
d
def
keyvalues2
(
key1
,
value1
,
key2
,
value2
):
"""
>>>
keyvalues2(1, 2, 3, 4
)
{1: 2, 3: 4}
>>>
sorted(keyvalues2(1, 2, 3, 4).items()
)
[(1, 2), (3, 4)]
"""
d
=
{
key1
:
value1
,
key2
:
value2
,}
return
d
...
...
tests/run/exec_noargs.pyx
View file @
4a009f36
...
...
@@ -11,8 +11,8 @@ def exec_module_scope():
def
exec_func_scope
():
"""
>>>
exec_func_scope(
)
{'a': 'b', 'G': 1234}
>>>
sorted(exec_func_scope().items()
)
[('G', 1234), ('a', 'b')]
"""
d
=
{}
exec
"d['a'] = 'b'; d['G'] = GLOBAL"
...
...
tests/run/metaclass.pyx
View file @
4a009f36
...
...
@@ -120,6 +120,6 @@ kwargs = {'c': 0}
@
cython
.
test_assert_path_exists
(
"//PyClassMetaclassNode"
,
"//Py3ClassNode"
)
class
Foo3
(
metaclass
=
Base3
,
a
=
0
,
b
=
0
,
**
kwargs
):
"""
>>>
Foo3.kwargs
{'a': 0, 'c': 0, 'b': 0}
>>>
sorted(Foo3.kwargs.items())
[('a', 0), ('b', 0), ('c', 0)]
"""
tests/run/r_extstarargs.pyx
View file @
4a009f36
...
...
@@ -3,31 +3,31 @@ __doc__ = u"""
Name: Brian
Airspeed: 42
Extra args: ()
Extra keywords:
{}
Extra keywords:
[]
>>> s = Swallow("Brian", 42, "African")
Name: Brian
Airspeed: 42
Extra args: ('African',)
Extra keywords:
{}
Extra keywords:
[]
>>> s = Swallow("Brian", airspeed = 42)
Name: Brian
Airspeed: 42
Extra args: ()
Extra keywords:
{}
Extra keywords:
[]
>>> s = Swallow("Brian", airspeed = 42, species = "African", coconuts = 3)
Name: Brian
Airspeed: 42
Extra args: ()
Extra keywords:
{'coconuts': 3, 'species': 'African'}
Extra keywords:
[('coconuts', 3), ('species', 'African')]
>>> s = Swallow("Brian", 42, "African", coconuts = 3)
Name: Brian
Airspeed: 42
Extra args: ('African',)
Extra keywords:
{'coconuts': 3}
Extra keywords:
[('coconuts', 3)]
"""
cdef
class
Swallow
:
...
...
@@ -36,4 +36,4 @@ cdef class Swallow:
print
u"Name:"
,
name
print
u"Airspeed:"
,
airspeed
print
u"Extra args:"
,
args
print
u"Extra keywords:"
,
kwds
print
u"Extra keywords:"
,
sorted
(
kwds
.
items
())
tests/run/r_starargs.pyx
View file @
4a009f36
...
...
@@ -4,29 +4,29 @@ def swallow(name, airspeed, *args, **kwds):
Name: Brian
Airspeed: 42
Extra args: ()
Extra keywords:
{}
Extra keywords:
[]
>>> swallow("Brian", 42, "African")
Name: Brian
Airspeed: 42
Extra args: ('African',)
Extra keywords:
{}
Extra keywords:
[]
>>> swallow("Brian", airspeed = 42)
Name: Brian
Airspeed: 42
Extra args: ()
Extra keywords:
{}
Extra keywords:
[]
>>> swallow("Brian", airspeed = 42, species = "African", coconuts = 3)
Name: Brian
Airspeed: 42
Extra args: ()
Extra keywords:
{'coconuts': 3, 'species': 'African'}
Extra keywords:
[('coconuts', 3), ('species', 'African')]
>>> swallow("Brian", 42, "African", coconuts = 3)
Name: Brian
Airspeed: 42
Extra args: ('African',)
Extra keywords:
{'coconuts': 3}
Extra keywords:
[('coconuts', 3)]
"""
print
u"Name:"
,
name
print
u"Airspeed:"
,
airspeed
print
u"Extra args:"
,
args
print
u"Extra keywords:"
,
kwds
print
u"Extra keywords:"
,
sorted
(
kwds
.
items
())
tests/run/rodriguez_1.pyx
View file @
4a009f36
__doc__
=
u"""
>>> b = B()
>>>
b.t
{1: ((1, 2, 3),), 2: (1, 2, 3)}
>>>
sorted(b.t.items())
[(1, ((1, 2, 3),)), (2, (1, 2, 3))]
"""
class
B
:
...
...
tests/run/struct_conversion.pyx
View file @
4a009f36
...
...
@@ -5,8 +5,8 @@ cdef struct Point:
def
test_constructor
(
x
,
y
,
color
):
"""
>>>
test_constructor(1,2,255
)
{'y': 2.0, 'x': 1.0, 'color': 255}
>>>
sorted(test_constructor(1,2,255).items()
)
[('color', 255), ('x', 1.0), ('y', 2.0)]
>>> test_constructor(1,None,255)
Traceback (most recent call last):
...
...
...
@@ -17,8 +17,8 @@ def test_constructor(x, y, color):
def
test_constructor_kwds
(
x
,
y
,
color
):
"""
>>>
test_constructor_kwds(1.25, 2.5, 128
)
{'y': 2.5, 'x': 1.25, 'color': 128}
>>>
sorted(test_constructor_kwds(1.25, 2.5, 128).items()
)
[('color', 128), ('x', 1.25), ('y', 2.5)]
>>> test_constructor_kwds(1.25, 2.5, None)
Traceback (most recent call last):
...
...
...
@@ -29,8 +29,8 @@ def test_constructor_kwds(x, y, color):
def
test_dict_construction
(
x
,
y
,
color
):
"""
>>>
test_dict_construction(4, 5, 64
)
{'y': 5.0, 'x': 4.0, 'color': 64}
>>>
sorted(test_dict_construction(4, 5, 64).items()
)
[('color', 64), ('x', 4.0), ('y', 5.0)]
>>> test_dict_construction("foo", 5, 64)
Traceback (most recent call last):
...
...
...
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