[Zope3-checkins] CVS: Packages/ZConfig/tests - test_schema.py:1.1.2.27
Fred L. Drake, Jr.
fred@zope.com
Thu, 19 Dec 2002 11:51:28 -0500
Update of /cvs-repository/Packages/ZConfig/tests
In directory cvs.zope.org:/tmp/cvs-serv28967/tests
Modified Files:
Tag: zconfig-schema-devel-branch
test_schema.py
Log Message:
Straighten out exceptions so schema parsing gets a distinct exception type
that carries location information as usable attributes.
=== Packages/ZConfig/tests/test_schema.py 1.1.2.26 => 1.1.2.27 ===
--- Packages/ZConfig/tests/test_schema.py:1.1.2.26 Thu Dec 19 10:18:30 2002
+++ Packages/ZConfig/tests/test_schema.py Thu Dec 19 11:51:27 2002
@@ -255,6 +255,18 @@
" <sect a/>\n"
"</nesting>")
+ def test_disallowed_duplicate_attribute(self):
+ self.assertRaises(ZConfig.SchemaError,
+ self.load_schema_text,
+ "<schema>"
+ " <key name='a'/>"
+ " <key name='b' attribute='a'/>"
+ "</schema>")
+
+ def test_unknown_datatype_name(self):
+ self.assertRaises(ZConfig.SchemaError,
+ self.load_schema_text, "<schema datatype='foobar'/>")
+
def test_load_sectiongroup(self):
schema = self.load_schema_text(
"<schema>"
@@ -313,6 +325,14 @@
"</schema>")
conf = self.load_config_text(schema, "some-key 42\n some-key 43")
self.assertEqual(conf.keymap, {'some-key': [42, 43]})
+
+ def test_arbitrary_key_bad_schema(self):
+ self.assertRaises(ZConfig.SchemaError,
+ self.load_schema_text,
+ "<schema>"
+ " <key name='+' attribute='attr1'/>"
+ " <key name='+' attribute='attr2'/>"
+ "</schema>")
# datatype tests