[Python-checkins] python/dist/src/Lib/test test_cfgparser.py,1.16,1.17
fdrake@users.sourceforge.net
fdrake@users.sourceforge.net
Fri, 25 Oct 2002 13:42:46 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv27205
Modified Files:
test_cfgparser.py
Log Message:
Add tests for both raw and non-raw versions of the items() methods.
Index: test_cfgparser.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_cfgparser.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** test_cfgparser.py 25 Oct 2002 19:40:49 -0000 1.16
--- test_cfgparser.py 25 Oct 2002 20:42:44 -0000 1.17
***************
*** 231,234 ****
--- 231,246 ----
defaults={"getname": "%(__name__)s"})
+ def check_items_config(self, expected):
+ cf = self.fromstring(
+ "[section]\n"
+ "name = value\n"
+ "key: |%(name)s| \n"
+ "getdefault: |%(default)s|\n"
+ "getname: |%(__name__)s|",
+ defaults={"default": "<default>"})
+ L = list(cf.items("section"))
+ L.sort()
+ self.assertEqual(L, expected)
+
class ConfigParserTestCase(TestCaseBase):
***************
*** 246,249 ****
--- 258,268 ----
self.get_error(ConfigParser.InterpolationDepthError, "Foo", "bar11")
+ def test_items(self):
+ self.check_items_config([('default', '<default>'),
+ ('getdefault', '|<default>|'),
+ ('getname', '|section|'),
+ ('key', '|value|'),
+ ('name', 'value')])
+
class RawConfigParserTestCase(TestCaseBase):
***************
*** 262,265 ****
--- 281,291 ----
eq(cf.get("Foo", "bar11"),
"something %(with11)s lots of interpolation (11 steps)")
+
+ def test_items(self):
+ self.check_items_config([('default', '<default>'),
+ ('getdefault', '|%(default)s|'),
+ ('getname', '|%(__name__)s|'),
+ ('key', '|%(name)s|'),
+ ('name', 'value')])