Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
90caf017
Commit
90caf017
authored
Feb 15, 2015
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Plain Diff
Issue #19681: Test the repr of partial with more than one keyword argument.
parents
c86ca26d
0aa74e10
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
Lib/test/test_functools.py
Lib/test/test_functools.py
+9
-7
No files found.
Lib/test/test_functools.py
View file @
90caf017
...
...
@@ -155,9 +155,9 @@ class TestPartialC(TestPartial, unittest.TestCase):
def
test_repr
(
self
):
args
=
(
object
(),
object
())
args_repr
=
', '
.
join
(
repr
(
a
)
for
a
in
args
)
#
kwargs = {'a': object(), 'b': object()}
kwargs
=
{
'a'
:
object
()}
kwargs_repr
=
', '
.
join
(
"%s=%r"
%
(
k
,
v
)
for
k
,
v
in
kwargs
.
items
())
kwargs
=
{
'a'
:
object
(),
'b'
:
object
()}
kwargs
_reprs
=
[
'a={a!r}, b={b!r}'
.
format_map
(
kwargs
),
'b={b!r}, a={a!r}'
.
format_map
(
kwargs
)]
if
self
.
partial
is
c_functools
.
partial
:
name
=
'functools.partial'
else
:
...
...
@@ -172,12 +172,14 @@ class TestPartialC(TestPartial, unittest.TestCase):
repr
(
f
))
f
=
self
.
partial
(
capture
,
**
kwargs
)
self
.
assertEqual
(
'{}({!r}, {})'
.
format
(
name
,
capture
,
kwargs_repr
),
repr
(
f
))
self
.
assertIn
(
repr
(
f
),
[
'{}({!r}, {})'
.
format
(
name
,
capture
,
kwargs_repr
)
for
kwargs_repr
in
kwargs_reprs
])
f
=
self
.
partial
(
capture
,
*
args
,
**
kwargs
)
self
.
assertEqual
(
'{}({!r}, {}, {})'
.
format
(
name
,
capture
,
args_repr
,
kwargs_repr
),
repr
(
f
))
self
.
assertIn
(
repr
(
f
),
[
'{}({!r}, {}, {})'
.
format
(
name
,
capture
,
args_repr
,
kwargs_repr
)
for
kwargs_repr
in
kwargs_reprs
])
def
test_pickle
(
self
):
f
=
self
.
partial
(
signature
,
'asdf'
,
bar
=
True
)
...
...
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