def test_split(self): local_path = URI('/some/long/dir/structure') pth, tail = local_path.split() self.assertEqual(pth, URI('/some/long/dir')) self.assertEqual(tail, 'structure') local_path = URI('somedir') pth, tail = local_path.split() self.assertEqual(pth, URI('.')) self.assertEqual(tail, 'somedir')
def test_split(self): local_path = URI('/some/long/dir/structure') pth, tail = local_path.split() self.assertEqual(pth, URI('/some/long/dir')) self.assertEqual(tail, 'structure') local_path = URI('somedir') pth, tail = local_path.split() self.assertEqual(pth, URI('.')) self.assertEqual(tail, 'somedir')
def test_split_windows(self): path = URI(r'C:\some\path\on\windows', sep='\\') pth, tail = path.split() self.assertEqual(pth.uri, 'file:///C/some/path/on') self.assertEqual(pth.path, r'C:\some\path\on') self.assertEqual(pth, URI(r'C:\some\path\on', sep='\\')) self.assertEqual(tail, 'windows')
def test_split_windows(self): path = URI(r'C:\some\path\on\windows', sep='\\') pth, tail = path.split() self.assertEqual(pth.uri, 'file:///C/some/path/on') self.assertEqual(pth.path, r'C:\some\path\on') self.assertEqual(pth, URI(r'C:\some\path\on', sep='\\')) self.assertEqual(tail, 'windows')
def test_root_split(self): pth = URI('/') directory, name = pth.split() self.assertEqual(directory, URI('/')) self.assertEqual(name, '')
def test_split_with_args(self): local_path = URI('file:///some/long?extra=arg') pth, tail = local_path.split() self.assertEqual(tail, 'long')
def test_split_with_short_path(self): local_path = URI('/some') pth, tail = local_path.split() self.assertEqual(pth, URI('/')) self.assertEqual(tail, 'some')
def test_root_split(self): pth = URI('/') directory, name = pth.split() self.assertEqual(directory, URI('/')) self.assertEqual(name, '')
def test_split_with_args(self): local_path = URI('file:///some/long?extra=arg') pth, tail = local_path.split() self.assertEqual(tail, 'long')
def test_split_with_short_path(self): local_path = URI('/some') pth, tail = local_path.split() self.assertEqual(pth, URI('/')) self.assertEqual(tail, 'some')