[Python-checkins] CVS: python/dist/src/Lib/test test_cfgparser.py,1.6,1.7
Fred L. Drake
fdrake@users.sourceforge.net
Mon, 26 Feb 2001 13:55:36 -0800
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv26731/test
Modified Files:
test_cfgparser.py
Log Message:
Make sure ConfigParser uses .optionxform() consistently; this affects
.has_option(), .remove_option(), and .set().
This closes SF tracker #232913.
Index: test_cfgparser.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_cfgparser.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** test_cfgparser.py 2001/02/14 15:30:31 1.6
--- test_cfgparser.py 2001/02/26 21:55:34 1.7
***************
*** 49,52 ****
--- 49,75 ----
+ def case_sensitivity():
+ print "Testing case sensitivity..."
+ cf = ConfigParser.ConfigParser()
+ cf.add_section("A")
+ cf.add_section("a")
+ L = cf.sections()
+ L.sort()
+ verify(L == ["A", "a"])
+ cf.set("a", "B", "value")
+ verify(cf.options("a") == ["b"])
+ verify(cf.get("a", "b", raw=1) == "value",
+ "could not locate option, expecting case-insensitive option names")
+ verify(cf.has_option("a", "b"))
+ cf.set("A", "A-B", "A-B value")
+ for opt in ("a-b", "A-b", "a-B", "A-B"):
+ verify(cf.has_option("A", opt),
+ "has_option() returned false for option which should exist")
+ verify(cf.options("A") == ["a-b"])
+ verify(cf.options("a") == ["b"])
+ cf.remove_option("a", "B")
+ verify(cf.options("a") == [])
+
+
def interpolation(src):
print "Testing value interpolation..."
***************
*** 150,153 ****
--- 173,177 ----
foo[de]=Deutsch
""")
+ case_sensitivity()
interpolation(r"""
[Foo]