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
3ea5224c
Commit
3ea5224c
authored
Aug 09, 2011
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue 12717: Fix-up an earlier backport in ConfigParser.
parent
d7fbc8bf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
1 deletion
+23
-1
Lib/ConfigParser.py
Lib/ConfigParser.py
+1
-1
Lib/test/test_cfgparser.py
Lib/test/test_cfgparser.py
+22
-0
No files found.
Lib/ConfigParser.py
View file @
3ea5224c
...
...
@@ -570,7 +570,7 @@ class _Chainmap(_UserDict.DictMixin):
def keys(self):
result = []
seen = set()
for mapping in self_maps:
for mapping in self
.
_maps:
for key in mapping:
if key not in seen:
result.append(key)
...
...
Lib/test/test_cfgparser.py
View file @
3ea5224c
...
...
@@ -529,6 +529,27 @@ class SafeConfigParserTestCase(ConfigParserTestCase):
class
SafeConfigParserTestCaseNoValue
(
SafeConfigParserTestCase
):
allow_no_value
=
True
class
TestChainMap
(
unittest
.
TestCase
):
def
test_issue_12717
(
self
):
d1
=
dict
(
red
=
1
,
green
=
2
)
d2
=
dict
(
green
=
3
,
blue
=
4
)
dcomb
=
d2
.
copy
()
dcomb
.
update
(
d1
)
cm
=
ConfigParser
.
_Chainmap
(
d1
,
d2
)
self
.
assertIsInstance
(
cm
.
keys
(),
list
)
self
.
assertEqual
(
set
(
cm
.
keys
()),
set
(
dcomb
.
keys
()))
# keys()
self
.
assertEqual
(
set
(
cm
.
values
()),
set
(
dcomb
.
values
()))
# values()
self
.
assertEqual
(
set
(
cm
.
items
()),
set
(
dcomb
.
items
()))
# items()
self
.
assertEqual
(
set
(
cm
),
set
(
dcomb
))
# __iter__ ()
self
.
assertEqual
(
cm
,
dcomb
)
# __eq__()
self
.
assertEqual
([
cm
[
k
]
for
k
in
dcomb
],
dcomb
.
values
())
# __getitem__()
klist
=
'red green blue black brown'
.
split
()
self
.
assertEqual
([
cm
.
get
(
k
,
10
)
for
k
in
klist
],
[
dcomb
.
get
(
k
,
10
)
for
k
in
klist
])
# get()
self
.
assertEqual
([
k
in
cm
for
k
in
klist
],
[
k
in
dcomb
for
k
in
klist
])
# __contains__()
self
.
assertEqual
([
cm
.
has_key
(
k
)
for
k
in
klist
],
[
dcomb
.
has_key
(
k
)
for
k
in
klist
])
# has_key()
class
Issue7005TestCase
(
unittest
.
TestCase
):
"""Test output when None is set() as a value and allow_no_value == False.
...
...
@@ -591,6 +612,7 @@ def test_main():
SafeConfigParserTestCaseNoValue
,
SortedTestCase
,
Issue7005TestCase
,
TestChainMap
,
)
...
...
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