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
1bf71172
Commit
1bf71172
authored
Mar 08, 2002
by
Andrew M. Kuchling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
As part of fixing bug #523301, add a simple test of ConfigParser.write()
parent
00824ed7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
Lib/test/output/test_cfgparser
Lib/test/output/test_cfgparser
+1
-0
Lib/test/test_cfgparser.py
Lib/test/test_cfgparser.py
+29
-0
No files found.
Lib/test/output/test_cfgparser
View file @
1bf71172
test_cfgparser
Testing basic accessors...
Testing writing of files...
Testing case sensitivity...
Testing interpretation of boolean Values...
Testing value interpolation...
...
...
Lib/test/test_cfgparser.py
View file @
1bf71172
...
...
@@ -14,6 +14,7 @@ def basic(src):
verify
(
L
==
[
r'Commented Bar'
,
r'Foo Bar'
,
r'Internationalized Stuff'
,
r'Long Line'
,
r'Section\
wi
th$weird%characters['
'
\
t
'
,
r'Spacey Bar'
,
],
...
...
@@ -47,7 +48,26 @@ def basic(src):
"remove_option() failed to report non-existance of option"
" that never existed"
)
verify
(
cf
.
get
(
'Long Line'
,
'foo'
,
raw
=
1
)
==
'this line is much, much longer than my editor
\
n
likes it.'
)
def
write
(
src
):
print
"Testing writing of files..."
cf
=
ConfigParser
.
ConfigParser
()
sio
=
StringIO
.
StringIO
(
src
)
cf
.
readfp
(
sio
)
output
=
StringIO
.
StringIO
()
cf
.
write
(
output
)
verify
(
output
,
"""[DEFAULT]
foo = another very
long line
[Long Line]
foo = this line is much, much longer than my editor
likes it.
"""
)
def
case_sensitivity
():
print
"Testing case sensitivity..."
cf
=
ConfigParser
.
ConfigParser
()
...
...
@@ -191,6 +211,9 @@ foo=bar
foo = bar
[Commented Bar]
foo: bar ; comment
[Long Line]
foo: this line is much, much longer than my editor
likes it.
[Section\
wi
th$weird%characters["""
'
\
t
'
r"""]
[Internationalized Stuff]
foo[bg]: Bulgarian
...
...
@@ -198,6 +221,12 @@ foo=Default
foo[en]=English
foo[de]=Deutsch
"""
)
write
(
"""[Long Line]
foo: this line is much, much longer than my editor
likes it.
[DEFAULT]
foo: another very
long line"""
)
case_sensitivity
()
boolean
(
r"""
[BOOLTEST]
...
...
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