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
168beada
Commit
168beada
authored
Oct 08, 2001
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added tests that check getboolean() with the newly allowed values from
SF patch #467580.
parent
44383384
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
0 deletions
+38
-0
Lib/test/output/test_cfgparser
Lib/test/output/test_cfgparser
+1
-0
Lib/test/test_cfgparser.py
Lib/test/test_cfgparser.py
+37
-0
No files found.
Lib/test/output/test_cfgparser
View file @
168beada
test_cfgparser
Testing basic accessors...
Testing case sensitivity...
Testing interpretation of boolean Values...
Testing value interpolation...
Testing parse errors...
Testing query interface...
...
...
Lib/test/test_cfgparser.py
View file @
168beada
...
...
@@ -78,6 +78,25 @@ def case_sensitivity():
verify
(
cf
.
get
(
"MySection"
,
"Option"
)
==
"first line
\
n
second line"
)
def
boolean
(
src
):
print
"Testing interpretation of boolean Values..."
cf
=
ConfigParser
.
ConfigParser
()
sio
=
StringIO
.
StringIO
(
src
)
cf
.
readfp
(
sio
)
for
x
in
range
(
1
,
5
):
verify
(
cf
.
getboolean
(
'BOOLTEST'
,
't%d'
%
(
x
))
==
1
)
for
x
in
range
(
1
,
5
):
verify
(
cf
.
getboolean
(
'BOOLTEST'
,
'f%d'
%
(
x
))
==
0
)
for
x
in
range
(
1
,
5
):
try
:
cf
.
getboolean
(
'BOOLTEST'
,
'e%d'
%
(
x
))
except
ValueError
:
pass
else
:
raise
TestFailed
(
"getboolean() failed to report a non boolean value"
)
def
interpolation
(
src
):
print
"Testing value interpolation..."
cf
=
ConfigParser
.
ConfigParser
({
"getname"
:
"%(__name__)s"
})
...
...
@@ -180,6 +199,24 @@ foo[en]=English
foo[de]=Deutsch
"""
)
case_sensitivity
()
boolean
(
r"""
[BOOLTEST]
T1=1
T2=TRUE
T3=True
T4=oN
T5=yes
F1=0
F2=FALSE
F3=False
F4=oFF
F5=nO
E1=2
E2=foo
E3=-1
E4=0.1
E5=FALSE AND MORE
"""
)
interpolation
(
r"""
[Foo]
bar=something %(with1)s interpolation (1 step)
...
...
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