[Zodb-checkins] CVS: Zope/lib/python/ZConfig/tests - testConfig.py:1.1.4.7 testSchema.py:1.1.2.11

Chris McDonough chrism@zope.com
Tue, 26 Nov 2002 18:52:35 -0500


Update of /cvs-repository/Zope/lib/python/ZConfig/tests
In directory cvs.zope.org:/tmp/cvs-serv32455/tests

Modified Files:
      Tag: chrism-install-branch
	testConfig.py testSchema.py 
Log Message:
Merge with HEAD and exorcise __getitem__.


=== Zope/lib/python/ZConfig/tests/testConfig.py 1.1.4.6 => 1.1.4.7 ===
--- Zope/lib/python/ZConfig/tests/testConfig.py:1.1.4.6	Sun Nov 24 18:53:33 2002
+++ Zope/lib/python/ZConfig/tests/testConfig.py	Tue Nov 26 18:52:34 2002
@@ -19,12 +19,12 @@
 import unittest
 import urllib
 import urlparse
-import warnings
 
 import ZConfig
 
 from ZConfig.Context import Context
 from ZConfig.Common import ConfigurationError, ConfigurationTypeError
+from ZConfig.Common import ConfigurationMissingSectionError
 
 try:
     __file__
@@ -86,15 +86,6 @@
         conf = self.load("simple.conf")
         self.check_simple_gets(conf)
 
-    def test_simple_getitem(self):
-        conf = self.load("simple.conf")
-        self.assertEqual(conf['empty'], '')
-        self.assertEqual(conf['int-var'], '12')
-        self.assertEqual(conf['list-3'], 'abc def ghi')
-        def check(conf=conf):
-            conf['really-not-there']
-        self.assertRaises(KeyError, check)
-
     def test_type_errors(self):
         conf = self.load("simple.conf")
         getbool = conf.getbool
@@ -132,7 +123,7 @@
                          [("var", "bar"), ("var-one", "splat"),
                           ("var-two", "stuff")])
 
-    def has_key(self):
+    def test_has_key(self):
         conf = self.load("simplesections.conf")
         sect = conf.getSection("section", "name")
         for key in ("var", "var-one", "var-two"):
@@ -140,6 +131,11 @@
             self.assert_(sect.has_key(key.upper()))
         self.assert_(not sect.has_key("var-three"))
 
+    def test_missing_named_section(self):
+        conf = self.load("simplesections.conf")
+        self.assertRaises(ConfigurationMissingSectionError,
+                          conf.getSection, "section", "does-not-exist")
+
     def test_keys(self):
         conf = self.load("simplesections.conf")
         self.assertEqual(sorted_keys(conf),
@@ -275,6 +271,7 @@
     def check_load_from_path(self, path):
         context = Context()
         context.load(path)
+
 
 class NoDelegationContext(Context):
     def getDelegateType(self, type):


=== Zope/lib/python/ZConfig/tests/testSchema.py 1.1.2.10 => 1.1.2.11 ===
--- Zope/lib/python/ZConfig/tests/testSchema.py:1.1.2.10	Tue Nov 26 12:39:22 2002
+++ Zope/lib/python/ZConfig/tests/testSchema.py	Tue Nov 26 18:52:34 2002
@@ -192,15 +192,6 @@
         conf = self.load("simple.conf", 'simple.schema')
         self.check_simple_gets(conf)
 
-    def test_simple_getitem(self):
-        conf = self.load("simple.conf", 'simple.schema')
-        self.assertEqual(conf['empty'], '')
-        self.assertEqual(conf['int-var'], '12')
-        self.assertEqual(conf['list-3'], 'abc def ghi')
-        def check(conf=conf):
-            conf['really-not-there']
-        self.assertRaises(KeyError, check)
-
     def test_type_errors(self):
         conf = self.load("simple.conf", 'simple.schema')
         getbool = conf.getbool