[Zope-Checkins] CVS: Packages/ZConfig/tests - test_schema.py:1.1.2.11

Fred L. Drake, Jr. fred@zope.com
Thu, 12 Dec 2002 15:17:40 -0500


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

Modified Files:
      Tag: zconfig-schema-devel-branch
	test_schema.py 
Log Message:
Add a test that section names can't be re-used within the same lexical
scope, and they they can be re-used in different scopes.


=== Packages/ZConfig/tests/test_schema.py 1.1.2.10 => 1.1.2.11 ===
--- Packages/ZConfig/tests/test_schema.py:1.1.2.10	Thu Dec 12 14:38:55 2002
+++ Packages/ZConfig/tests/test_schema.py	Thu Dec 12 15:17:40 2002
@@ -193,6 +193,23 @@
         self.assertEqual(conf.c, [41, 42, 43])
         self.assertEqual(conf.d, [])
 
+    def test_duplicate_section_names(self):
+        schema = self.load_schema_text(
+            "<schema>"
+            "  <sectiontype name='sect'/>"
+            "  <sectiontype name='nesting'>"
+            "    <section name='a' type='sect'/>"
+            "    </sectiontype>"
+            "  <section name='a' type='nesting'/>"
+            "</schema>")
+        self.assertRaises(ZConfig.ConfigurationError,
+                          self.load_config_text,
+                          schema, "<sect a/>\n<sect a/>\n")
+        conf = self.load_config_text(schema,
+                                     "<nesting a>\n"
+                                     "  <sect a/>\n"
+                                     "</nesting>")
+
     # utilities
 
     def load_both(self, schema_url, conf_url):