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

Fred L. Drake, Jr. fred@zope.com
Thu, 19 Dec 2002 10:18:30 -0500


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

Modified Files:
      Tag: zconfig-schema-devel-branch
	test_schema.py 
Log Message:
Basic support for supporting arbitrary keys as <key name="+".../>
(also multikeys).


=== Packages/ZConfig/tests/test_schema.py 1.1.2.25 => 1.1.2.26 ===
--- Packages/ZConfig/tests/test_schema.py:1.1.2.25	Wed Dec 18 21:26:05 2002
+++ Packages/ZConfig/tests/test_schema.py	Thu Dec 19 10:18:30 2002
@@ -296,6 +296,24 @@
         eq(conf.g[2].k2, "default2")
         eq(conf.g[3].k2, "value2")
 
+    def test_arbitrary_key(self):
+        schema = self.load_schema_text(
+            "<schema>"
+            "  <key name='+' required='yes' attribute='keymap'"
+            "       datatype='integer'/>"
+            "</schema>")
+        conf = self.load_config_text(schema, "some-key 42")
+        self.assertEqual(conf.keymap, {'some-key': 42})
+
+    def test_arbitrary_multikey(self):
+        schema = self.load_schema_text(
+            "<schema>"
+            "  <multikey name='+' required='yes' attribute='keymap'"
+            "            datatype='integer'/>"
+            "</schema>")
+        conf = self.load_config_text(schema, "some-key 42\n some-key 43")
+        self.assertEqual(conf.keymap, {'some-key': [42, 43]})
+
     # datatype tests
 
     def test_datatype_basickey(self):