[Zope3-checkins] CVS: Packages/ZConfig/tests - test_loader.py:1.1.2.4

Fred L. Drake, Jr. fred@zope.com
Thu, 2 Jan 2003 09:50:46 -0500


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

Modified Files:
      Tag: zconfig-schema-devel-branch
	test_loader.py 
Log Message:
Add test for urldefrag().


=== Packages/ZConfig/tests/test_loader.py 1.1.2.3 => 1.1.2.4 ===
--- Packages/ZConfig/tests/test_loader.py:1.1.2.3	Tue Dec 24 15:51:42 2002
+++ Packages/ZConfig/tests/test_loader.py	Thu Jan  2 09:50:43 2003
@@ -20,7 +20,7 @@
 import ZConfig
 import ZConfig.loader
 
-from ZConfig.url import urljoin, urlsplit
+from ZConfig import url
 
 from ZConfig.tests.test_config import CONFIG_BASE
 
@@ -69,17 +69,24 @@
         r.close()
         self.assert_(r.closed)
 
+    def test_urldefrag(self):
+        eq = self.assertEqual
+        eq(url.urldefrag("zconfig:abc/def.ghi#frag"),
+           ("zconfig:abc/def.ghi", "frag"))
+        eq(url.urldefrag("zconfig:abc/def.ghi"),
+           ("zconfig:abc/def.ghi", ''))
+
     def test_urlsplit(self):
-        parts = urlsplit("zconfig:path/to/resource/file.txt#fragment")
+        parts = url.urlsplit("zconfig:path/to/resource/file.txt#fragment")
         self.assertEqual(parts, ("zconfig", '', "path/to/resource/file.txt",
                                  '', "fragment"))
-        parts = urlsplit("path/to/resource/file.txt#fragment", "zconfig")
+        parts = url.urlsplit("path/to/resource/file.txt#fragment", "zconfig")
         self.assertEqual(parts, ('', '', "path/to/resource/file.txt",
                                  '', "fragment"))
-        self.assertRaises(ValueError, urlsplit, "zconfig://host")
-        self.assertRaises(ValueError, urlsplit, "zconfig:host?query")
+        self.assertRaises(ValueError, url.urlsplit, "zconfig://host")
+        self.assertRaises(ValueError, url.urlsplit, "zconfig:host?query")
 
-        s = urljoin("zconfig:path/file.txt#oldfrag", "../newpath/foo.xml")
+        s = url.urljoin("zconfig:path/file.txt#oldfrag", "../newpath/foo.xml")
         self.assertEqual(s, "zconfig:newpath/foo.xml")