def test_windows(self): # c:\toto.txt uri = vfs.get_reference('c:stuff/blah') self.assertEqual('c:stuff/blah', uri.path) self.assertEqual('file', uri.scheme) uri = vfs.get_reference('file:///c:/stuff/blah') self.assertEqual('c:/stuff/blah', uri.path) self.assertEqual('file', uri.scheme) uri = vfs.get_reference('c:/stuff/blah#5') self.assertEqual('c:/stuff/blah', str(uri.path)) self.assertEqual('5', uri.fragment) self.assertEqual('file', uri.scheme) uri = vfs.get_reference('c:/stuff/blah#whatever') self.assertEqual('c:/stuff/blah#whatever', str(uri.path)) self.assertEqual(None, uri.fragment) self.assertEqual('file', uri.scheme)
def test_dirname(self): base = vfs.get_reference('stuff/blah') uri = vfs.get_dirname(base) self.assertEqual('stuff/', uri.path) uri = vfs.get_dirname(uri) print "path=%s" % uri.path self.assertEqual('./', uri.path) base = vfs.get_reference('/stuff/blah/') uri = vfs.get_dirname(base) self.assertEqual('/stuff/', uri.path) uri = vfs.get_dirname(uri) print "path=%s" % uri.path self.assertEqual('/', uri.path) base = vfs.get_reference('file:///stuff/blah/') uri = vfs.get_dirname(base) print "path=%s" % uri.path self.assertEqual('/stuff/', uri.path) uri = vfs.get_dirname(uri) print "path=%s" % uri.path self.assertEqual('/', uri.path)
def test_linux(self): # file://home/toto.txt uri = vfs.get_reference('stuff/blah') # print "scheme=%s authority=%s path=%s query=%s fragment=%s" % ( # uri.scheme, # uri.authority, # uri.path, # uri.query, # uri.fragment) self.assertEqual('stuff/blah', uri.path) self.assertEqual('', uri.scheme)
def test_windows_normalize(self): uri = vfs.get_reference('C:/stuff/blah') self.assertEqual('c:/stuff/blah', uri.path) self.assertEqual('file', uri.scheme)