def testGetComponentUriRel(self): self.assertEquals(ro_manifest.getComponentUriRel("/example/ro/dir", "a/b.txt"), rdflib.URIRef("a/b.txt")) self.assertEquals(ro_manifest.getComponentUriRel("/example/ro/dir/", "a/b.txt"), rdflib.URIRef("a/b.txt")) self.assertEquals(ro_manifest.getComponentUriRel("ro/dir", "a/b.txt"), rdflib.URIRef("a/b.txt")) self.assertEquals(ro_manifest.getComponentUriRel("ro/dir/", "a/b.txt"), rdflib.URIRef("a/b.txt")) self.assertEquals(ro_manifest.getComponentUriRel("/example/ro/dir", "a/b/d/"), rdflib.URIRef("a/b/d/")) self.assertEquals(ro_manifest.getComponentUriRel("/example/ro/dir/", "a/b/d/"), rdflib.URIRef("a/b/d/")) self.assertEquals(ro_manifest.getComponentUriRel("ro/dir", "a/b/d/"), rdflib.URIRef("a/b/d/")) self.assertEquals(ro_manifest.getComponentUriRel("ro/dir/", "a/b/d/"), rdflib.URIRef("a/b/d/")) self.assertEquals(ro_manifest.getComponentUriRel("/example/ro/dir", ""), rdflib.URIRef("")) self.assertEquals(ro_manifest.getComponentUriRel("/example/ro/dir/", ""), rdflib.URIRef("")) self.assertEquals(ro_manifest.getComponentUriRel("ro/dir", ""), rdflib.URIRef("")) self.assertEquals(ro_manifest.getComponentUriRel("ro/dir/", ""), rdflib.URIRef("")) self.assertEquals(ro_manifest.getComponentUriRel("/example/ro/dir", "/example/ro/dir/a/b.txt"), rdflib.URIRef("a/b.txt")) self.assertEquals(ro_manifest.getComponentUriRel("/example/ro/dir/", "/example/ro/dir/a/b.txt"), rdflib.URIRef("a/b.txt")) self.assertEquals(ro_manifest.getComponentUriRel("ro/dir", "%s/ro/dir/a/b.txt"%(cwd)), rdflib.URIRef("a/b.txt")) self.assertEquals(ro_manifest.getComponentUriRel("ro/dir/", "%s/ro/dir/a/b.txt"%(cwd)), rdflib.URIRef("a/b.txt")) self.assertEquals(ro_manifest.getComponentUriRel("/example/ro/dir", "/example/ro/dir/a/b/d/"), rdflib.URIRef("a/b/d/")) self.assertEquals(ro_manifest.getComponentUriRel("/example/ro/dir/", "/example/ro/dir/a/b/d/"), rdflib.URIRef("a/b/d/")) self.assertEquals(ro_manifest.getComponentUriRel("ro/dir", "%s/ro/dir/a/b/d/"%(cwd)), rdflib.URIRef("a/b/d/")) self.assertEquals(ro_manifest.getComponentUriRel("ro/dir/", "%s/ro/dir/a/b/d/"%(cwd)), rdflib.URIRef("a/b/d/")) self.assertEquals(ro_manifest.getComponentUriRel("/example/ro/dir", "/example/ro/dir/"), rdflib.URIRef("")) self.assertEquals(ro_manifest.getComponentUriRel("/example/ro/dir/", "/example/ro/dir/"), rdflib.URIRef("")) self.assertEquals(ro_manifest.getComponentUriRel("ro/dir", "%s/ro/dir/"%(cwd)), rdflib.URIRef("")) self.assertEquals(ro_manifest.getComponentUriRel("ro/dir/", "%s/ro/dir/"%(cwd)), rdflib.URIRef("")) # Test supplied file: URI string self.assertEquals(ro_manifest.getComponentUriRel("/example/ro/dir", "file:///example/ro/dir/a/b.txt"), rdflib.URIRef("a/b.txt")) self.assertEquals(ro_manifest.getComponentUriRel("/example/ro/dir/", "file:///example/ro/dir/a/b.txt"), rdflib.URIRef("a/b.txt")) self.assertEquals(ro_manifest.getComponentUriRel("/example/ro/dir", "file:///example/ro/dir/a/b/d/"), rdflib.URIRef("a/b/d/")) self.assertEquals(ro_manifest.getComponentUriRel("/example/ro/dir/", "file:///example/ro/dir/a/b/d/"), rdflib.URIRef("a/b/d/")) self.assertEquals(ro_manifest.getComponentUriRel("/example/ro/dir", "file:///example/ro/dir/"), rdflib.URIRef("")) self.assertEquals(ro_manifest.getComponentUriRel("/example/ro/dir/", "file:///example/ro/dir/"), rdflib.URIRef("")) # Test supplied file: URI self.assertEquals(ro_manifest.getComponentUriRel("/example/ro/dir", rdflib.URIRef("file:///example/ro/dir/a/b.txt")), rdflib.URIRef("a/b.txt")) self.assertEquals(ro_manifest.getComponentUriRel("/example/ro/dir/", rdflib.URIRef("file:///example/ro/dir/a/b.txt")), rdflib.URIRef("a/b.txt")) self.assertEquals(ro_manifest.getComponentUriRel("/example/ro/dir", rdflib.URIRef("file:///example/ro/dir/a/b/d/")), rdflib.URIRef("a/b/d/")) self.assertEquals(ro_manifest.getComponentUriRel("/example/ro/dir/", rdflib.URIRef("file:///example/ro/dir/a/b/d/")), rdflib.URIRef("a/b/d/")) self.assertEquals(ro_manifest.getComponentUriRel("/example/ro/dir", rdflib.URIRef("file:///example/ro/dir/")), rdflib.URIRef("")) self.assertEquals(ro_manifest.getComponentUriRel("/example/ro/dir/", rdflib.URIRef("file:///example/ro/dir/")), rdflib.URIRef("")) return
def testUri(rodir, path, uristring): self.assertEquals(ro_manifest.getComponentUriRel(rodir, rdflib.URIRef(path)), rdflib.URIRef(uristring)) return