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

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


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

Modified Files:
      Tag: zconfig-schema-devel-branch
	test_schema.py 
Log Message:
Changes to the schema language:
- The minOccurs and maxOccurs attributes are gone
- To specify minOccurs==1, use required="yes" in the schema
- To specify maxOccurs=="unbounded", use a <multikey> or <multisection>
  instead of <key> or <section>

This needs some code review and refactoring, but works.


=== Packages/ZConfig/tests/test_schema.py 1.1.2.22 => 1.1.2.23 ===
--- Packages/ZConfig/tests/test_schema.py:1.1.2.22	Mon Dec 16 13:23:42 2002
+++ Packages/ZConfig/tests/test_schema.py	Wed Dec 18 11:16:00 2002
@@ -74,18 +74,16 @@
         schema = self.load_schema_text(
             "<schema>"
             "  <key name='a' datatype='%s'/>"
-            "  <key name='b' datatype='%s'>"
+            "  <key name='b' datatype='%s' default='abc'/>"
+            "  <multikey name='c' datatype='%s'>"
             "    <default>abc</default>"
-            "    </key>"
-            "  <key name='c' datatype='%s' maxOccurs='3'>"
             "    <default>abc</default>"
-            "    <default>abc</default>"
-            "    </key>"
-            "  <key name='d' datatype='%s' maxOccurs='3'>"
+            "    </multikey>"
+            "  <multikey name='d' datatype='%s'>"
             "    <default>not</default>"
             "    <default>lower</default>"
             "    <default>case</default>"
-            "    </key>"
+            "    </multikey>"
             "</schema>"
             % (dtname, dtname, dtname, dtname))
         conf = self.load_config_text(schema,
@@ -172,17 +170,17 @@
     def test_multivalued_keys(self):
         schema = self.load_schema_text(
             "<schema handler='def'>"
-            "  <key name='a' minOccurs='2' maxOccurs='5' handler='ABC' />"
-            "  <key name='b' minOccurs='2' maxOccurs='2' datatype='integer'>"
+            "  <multikey name='a' handler='ABC' />"
+            "  <multikey name='b' datatype='integer'>"
             "    <default>1</default>"
             "    <default>2</default>"
-            "  </key>"
-            "  <key name='c' minOccurs='2' maxOccurs='3' datatype='integer'>"
+            "  </multikey>"
+            "  <multikey name='c' datatype='integer'>"
             "    <default>3</default>"
             "    <default>4</default>"
             "    <default>5</default>"
-            "  </key>"
-            "  <key name='d' maxOccurs='4' />"
+            "  </multikey>"
+            "  <multikey name='d' />"
             "</schema>")
         conf = self.load_config_text(schema,
                                      "a foo\n"
@@ -245,7 +243,7 @@
             "      <key name='k2'><default>default2</default></key>"
             "      </sectiontype>"
             "    </sectiongroup>"
-            "  <section name='*' type='group' maxOccurs='2' attribute='g'/>"
+            "  <multisection name='*' type='group' attribute='g'/>"
             "</schema>")
         # check the types that get defined
         t = schema.gettype("group")