@@ -48,6 +48,29 @@ def basic(src):
4848 " that never existed" )
4949
5050
51+ def case_sensitivity ():
52+ print "Testing case sensitivity..."
53+ cf = ConfigParser .ConfigParser ()
54+ cf .add_section ("A" )
55+ cf .add_section ("a" )
56+ L = cf .sections ()
57+ L .sort ()
58+ verify (L == ["A" , "a" ])
59+ cf .set ("a" , "B" , "value" )
60+ verify (cf .options ("a" ) == ["b" ])
61+ verify (cf .get ("a" , "b" , raw = 1 ) == "value" ,
62+ "could not locate option, expecting case-insensitive option names" )
63+ verify (cf .has_option ("a" , "b" ))
64+ cf .set ("A" , "A-B" , "A-B value" )
65+ for opt in ("a-b" , "A-b" , "a-B" , "A-B" ):
66+ verify (cf .has_option ("A" , opt ),
67+ "has_option() returned false for option which should exist" )
68+ verify (cf .options ("A" ) == ["a-b" ])
69+ verify (cf .options ("a" ) == ["b" ])
70+ cf .remove_option ("a" , "B" )
71+ verify (cf .options ("a" ) == [])
72+
73+
5174def interpolation (src ):
5275 print "Testing value interpolation..."
5376 cf = ConfigParser .ConfigParser ({"getname" : "%(__name__)s" })
@@ -149,6 +172,7 @@ def expect_parse_error(exctype, src):
149172foo[en]=English
150173foo[de]=Deutsch
151174""" )
175+ case_sensitivity ()
152176interpolation (r"""
153177[Foo]
154178bar=something %(with1)s interpolation (1 step)
0 commit comments