[Zodb-checkins] CVS: Packages/ZConfig/tests - test_schema.py:1.1.2.24

Fred L. Drake, Jr. fred@zope.com
Wed, 18 Dec 2002 16:24:54 -0500


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

Modified Files:
      Tag: zconfig-schema-devel-branch
	test_schema.py 
Log Message:
test_handler_ordering(): another test that handlers are called from
    inner to outer for nested sections.  This additionally caught that
    sections names weren't properly converted to attribute names.


=== Packages/ZConfig/tests/test_schema.py 1.1.2.23 => 1.1.2.24 ===
--- Packages/ZConfig/tests/test_schema.py:1.1.2.23	Wed Dec 18 11:16:00 2002
+++ Packages/ZConfig/tests/test_schema.py	Wed Dec 18 16:24:53 2002
@@ -215,6 +215,29 @@
         self.assertRaises(ZConfig.ConfigurationError,
                           self.handlers, {})
 
+    def test_handler_ordering(self):
+        schema = self.load_schema_text(
+            "<schema handler='c'>"
+            "  <sectiontype type='inner'>"
+            "  </sectiontype>"
+            "  <sectiontype type='outer'>"
+            "    <section type='inner' name='sect-inner' handler='a'/>"
+            "  </sectiontype>"
+            "  <section type='outer' name='sect-outer' handler='b'/>"
+            "</schema>")
+        conf = self.load_config_text(schema,
+                                     "<outer sect-outer>\n"
+                                     "  <inner sect-inner/>\n"
+                                     "</outer>",
+                                     num_handlers=3)
+        L = []
+        self.handlers({'a': L.append,
+                       'b': L.append,
+                       'c': L.append})
+        outer = conf.sect_outer
+        inner = outer.sect_inner
+        self.assertEqual(L, [inner, outer, conf])
+
     def test_duplicate_section_names(self):
         schema = self.load_schema_text(
             "<schema>"