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

Fred L. Drake, Jr. fred@zope.com
Fri, 20 Dec 2002 17:32:32 -0500


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

Modified Files:
      Tag: zconfig-schema-devel-branch
	test_schema.py 
Log Message:
The only reason we'll ever see exceptions related to the _finished
flag is because there's a problem with the schema XML, so raise
SchemaError for these.


=== Packages/ZConfig/tests/test_schema.py 1.1.2.30 => 1.1.2.31 ===
--- Packages/ZConfig/tests/test_schema.py:1.1.2.30	Fri Dec 20 12:08:13 2002
+++ Packages/ZConfig/tests/test_schema.py	Fri Dec 20 17:32:31 2002
@@ -127,9 +127,7 @@
         schema = self.load_schema_text(
             "<schema datatype='.appsection' prefix='%s'>"
             "  <sectiontype type='foo' datatype='.MySection'>"
-            "    <key name='sample' datatype='integer'>"
-            "      <default>345</default>"
-            "      </key>"
+            "    <key name='sample' datatype='integer' default='345'/>"
             "    </sectiontype>"
             "  <section name='sect' type='foo' />"
             "</schema>"
@@ -165,14 +163,14 @@
         schema = self.load_schema_text(
             "<schema>"
             "  <sectiontype type='type1'>"
-            "    <key name='key'><default>type1-value</default></key>"
+            "    <key name='key' default='type1-value'/>"
             "    </sectiontype>"
             "  <sectiontype type='type2'>"
-            "    <key name='key'><default>type2-value</default></key>"
+            "    <key name='key' default='type2-value'/>"
             "    <section name='sect' type='type1'/>"
             "    </sectiontype>"
             "  <sectiontype type='type3'>"
-            "    <key name='key'><default>type3-value</default></key>"
+            "    <key name='key' default='type3-value'/>"
             "    <section name='sect' type='type2'/>"
             "    </sectiontype>"
             "  <section name='sect' type='type3'/>"
@@ -228,6 +226,14 @@
         self.assertEqual(conf.c, [41, 42, 43])
         self.assertEqual(conf.d, [])
 
+    def test_key_default_element(self):
+        self.assertRaises(ZConfig.SchemaError, self.load_schema_text,
+                          "<schema>"
+                          "  <key name='name'>"
+                          "    <default>text</default>"
+                          "  </key>"
+                          "</schema>")
+
     def test_bad_handler_maps(self):
         schema = self.load_schema_text(
             "<schema>"
@@ -298,10 +304,10 @@
             "<schema>"
             "  <sectiongroup type='group'>"
             "    <sectiontype type='t1'>"
-            "      <key name='k1'><default>default1</default></key>"
+            "      <key name='k1' default='default1'/>"
             "      </sectiontype>"
             "    <sectiontype type='t2'>"
-            "      <key name='k2'><default>default2</default></key>"
+            "      <key name='k2' default='default2'/>"
             "      </sectiontype>"
             "    </sectiongroup>"
             "  <multisection name='*' type='group' attribute='g'/>"