Exemplo n.º 1
0
 def test_prefix_in_filename(self):
     test_path = '/a/b/common.txt'
     self.assertEqual(test_path, trim_path_prefixes(test_path, ['/a/b/c']))
     self.assertEqual(test_path,
                      trim_path_prefixes(test_path, ['/a/b/common']))
     self.assertEqual('common.txt',
                      trim_path_prefixes(test_path, ['/a/b/']))
Exemplo n.º 2
0
 def test_prefix_in_dir_name(self):
     test_path = '/a/b/common/foo.txt'
     self.assertEqual(test_path, trim_path_prefixes(test_path, ['/a/b/c']))
     self.assertEqual('foo.txt',
                      trim_path_prefixes(test_path, ['/a/b/common']))
Exemplo n.º 3
0
 def test_file_path(self):
     test_path = '/a/b/c/foo.txt'
     self.assertEqual('foo.txt', trim_path_prefixes(test_path, ['/a/b/c']))
Exemplo n.º 4
0
 def test_longest_matches(self):
     test_path = '/a/b/c'
     self.assertEqual('b/c', trim_path_prefixes(test_path, ['/a']))
     self.assertEqual('c', trim_path_prefixes(test_path, ['/a', '/a/b']))
Exemplo n.º 5
0
 def test_only_root_matches(self):
     test_path = '/a/b/c'
     self.assertEqual(test_path, trim_path_prefixes(test_path, ['/']))
     self.assertEqual(test_path, trim_path_prefixes(test_path, ['/x']))
Exemplo n.º 6
0
 def test_no_prefix(self):
     test_path = '/a/b/c'
     self.assertEqual(test_path, trim_path_prefixes(test_path, None))
     self.assertEqual(test_path, trim_path_prefixes(test_path, []))
     self.assertEqual(test_path, trim_path_prefixes(test_path, ['x']))