[Zodb-checkins] CVS: Zope3/src/ZConfig/tests - test_loader.py:1.16
Fred L. Drake, Jr.
fred at zope.com
Thu Jul 10 15:40:17 EDT 2003
Update of /cvs-repository/Zope3/src/ZConfig/tests
In directory cvs.zope.org:/tmp/cvs-serv4271/tests
Modified Files:
test_loader.py
Log Message:
Added "file" attribute to the "import" element; this allows a package to
provide more than one ZConfig schema component.
=== Zope3/src/ZConfig/tests/test_loader.py 1.15 => 1.16 ===
--- Zope3/src/ZConfig/tests/test_loader.py:1.15 Thu Jul 10 11:32:22 2003
+++ Zope3/src/ZConfig/tests/test_loader.py Thu Jul 10 14:39:40 2003
@@ -76,6 +76,31 @@
schema = loader.loadFile(sio)
self.assert_(schema.gettype("widget-a") is not None)
+ def test_import_from_package_with_file(self):
+ loader = ZConfig.loader.SchemaLoader()
+ sio = StringIO("<schema>"
+ " <import package='ZConfig.tests.library.widget'"
+ " file='extra.xml' />"
+ "</schema>")
+ schema = loader.loadFile(sio)
+ self.assert_(schema.gettype("extra-type") is not None)
+
+ def test_import_from_package_with_missing_file(self):
+ loader = ZConfig.loader.SchemaLoader()
+ sio = StringIO("<schema>"
+ " <import package='ZConfig.tests.library.widget'"
+ " file='notthere.xml' />"
+ "</schema>")
+ self.assertRaises(ZConfig.SchemaError, loader.loadFile, sio)
+
+ def test_import_from_package_with_directory_file(self):
+ loader = ZConfig.loader.SchemaLoader()
+ sio = StringIO("<schema>"
+ " <import package='ZConfig.tests.library.widget'"
+ " file='really/notthere.xml' />"
+ "</schema>")
+ self.assertRaises(ZConfig.SchemaError, loader.loadFile, sio)
+
def test_urlsplit_urlunsplit(self):
# Extracted from Python's test.test_urlparse module:
for url, parsed, split in [
More information about the Zodb-checkins
mailing list