Exemple #1
0
    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')
Exemple #2
0
    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')
Exemple #3
0
 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')
Exemple #4
0
 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')
Exemple #5
0
 def test_root_split(self):
     pth = URI('/')
     directory, name = pth.split()
     self.assertEqual(directory, URI('/'))
     self.assertEqual(name, '')
Exemple #6
0
 def test_split_with_args(self):
     local_path = URI('file:///some/long?extra=arg')
     pth, tail = local_path.split()
     self.assertEqual(tail, 'long')
Exemple #7
0
 def test_split_with_short_path(self):
     local_path = URI('/some')
     pth, tail = local_path.split()
     self.assertEqual(pth, URI('/'))
     self.assertEqual(tail, 'some')
Exemple #8
0
 def test_root_split(self):
     pth = URI('/')
     directory, name = pth.split()
     self.assertEqual(directory, URI('/'))
     self.assertEqual(name, '')
Exemple #9
0
 def test_split_with_args(self):
     local_path = URI('file:///some/long?extra=arg')
     pth, tail = local_path.split()
     self.assertEqual(tail, 'long')
Exemple #10
0
 def test_split_with_short_path(self):
     local_path = URI('/some')
     pth, tail = local_path.split()
     self.assertEqual(pth, URI('/'))
     self.assertEqual(tail, 'some')