[Zope3-checkins] CVS: Packages/ZConfig/tests - test_schema.py:1.1.2.12

Fred L. Drake, Jr. fred@zope.com
Fri, 13 Dec 2002 10:01:13 -0500


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

Modified Files:
      Tag: zconfig-schema-devel-branch
	test_schema.py 
Log Message:
Add test that we can at least load a sectiongroup; there are still
problems in using them.


=== Packages/ZConfig/tests/test_schema.py 1.1.2.11 => 1.1.2.12 ===
--- Packages/ZConfig/tests/test_schema.py:1.1.2.11	Thu Dec 12 15:17:40 2002
+++ Packages/ZConfig/tests/test_schema.py	Fri Dec 13 10:01:12 2002
@@ -210,6 +210,27 @@
                                      "  <sect a/>\n"
                                      "</nesting>")
 
+    def test_load_sectiongroup(self):
+        schema = self.load_schema_text(
+            "<schema>"
+            "  <sectiongroup name='group'>"
+            "    <sectiontype name='t1'/>"
+            "    <sectiontype name='t2'/>"
+            "    </sectiongroup>"
+            "  <section name='*' type='group' maxOccurs='2' attribute='g'/>"
+            "</schema>")
+        # check the types that get defined
+        t = schema.gettype("group")
+        self.assert_(t.istypegroup())
+        t1 = schema.gettype("t1")
+        self.assert_(not t1.istypegroup())
+        self.assert_(t.gettype("t1") is t1)
+        t2 = schema.gettype("t2")
+        self.assert_(not t2.istypegroup())
+        self.assert_(t.gettype("t2") is t2)
+        self.assertRaises(ZConfig.ConfigurationError, t.gettype, "group")
+        self.assert_(t1 is not t2)
+
     # utilities
 
     def load_both(self, schema_url, conf_url):