[Zodb-checkins] CVS: Packages/ZConfig/tests - testConfig.py:1.13

Fred L. Drake, Jr. fred@zope.com
Mon, 25 Nov 2002 17:52:18 -0500


Update of /cvs-repository/Packages/ZConfig/tests
In directory cvs.zope.org:/tmp/cvs-serv29105/tests

Modified Files:
	testConfig.py 
Log Message:
Update the API slightly: when a named section has been requested and is not
available, raise a more reasonable exception.


=== Packages/ZConfig/tests/testConfig.py 1.12 => 1.13 ===
--- Packages/ZConfig/tests/testConfig.py:1.12	Fri Nov 22 15:17:35 2002
+++ Packages/ZConfig/tests/testConfig.py	Mon Nov 25 17:52:17 2002
@@ -24,6 +24,7 @@
 
 from ZConfig.Context import Context
 from ZConfig.Common import ConfigurationError, ConfigurationTypeError
+from ZConfig.Common import ConfigurationMissingSectionError
 
 try:
     __file__
@@ -131,13 +132,18 @@
                          [("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"):
             self.assert_(sect.has_key(key))
             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")