Ejemplo n.º 1
0
 def test_commonPrefix11(self):
     """Check that leading ../current_subdir will be removed after path
        clearnup."""
     # Get the name of the current directory
     d = os.path.basename(os.getcwd())
     self.assertEqual(commonPrefix('../' + d + '/a/b', 'a/b'),
                      os.path.join('a', 'b'))
Ejemplo n.º 2
0
 def test_commonPrefix12a(self):
     # Cases like this only applies to Windows. Since Unix separator
     # is not '\\' but '/'. Unix will treat '\\' as part of file name.
     self.assertEqual(
         commonPrefix(os.path.join('a a', 'b b', 'c c'),
                      os.path.join('a a', 'b b')),
         os.path.join('a a', 'b b'))
Ejemplo n.º 3
0
 def test_commonPrefix16(self):
     # commonPrefix use the assumption that all relativepaths are based on
     # current working directory. If the resulting common prefix does not
     # have current workign directory as one of its parent directories, then
     # the absolute path will be used.
     self.assertEqual(commonPrefix(os.path.join('..', 'AVeryLongFileName'),
                                   os.path.join('..', 'AVeryLongFileName')),
                      os.path.normcase(os.path.abspath(os.path.join('..', 'AVeryLongFileName'))))
Ejemplo n.º 4
0
 def test_commonPrefix16(self):
     # commonPrefix use the assumption that all relativepaths are based on
     # current working directory. If the resulting common prefix does not
     # have current workign directory as one of its parent directories, then
     # the absolute path will be used.
     self.assertEqual(commonPrefix(os.path.join('..', 'AVeryLongFileName'),
                                   os.path.join('..', 'AVeryLongFileName')),
                      os.path.normcase(os.path.abspath(os.path.join('..', 'AVeryLongFileName'))))
Ejemplo n.º 5
0
 def test_commonPrefix9a(self):
     self.assertEqual(commonPrefix('a/b/..', 'a/b'), 'a')
Ejemplo n.º 6
0
 def test_commonPrefix8(self):
     self.assertEqual(
         commonPrefix(os.path.join('a', 'bc'), os.path.join('a', 'b')), 'a')
Ejemplo n.º 7
0
 def test_commonPrefix9(self):
     self.assertEqual(commonPrefix('a\\b\\..', 'a\\b'), 'a')
Ejemplo n.º 8
0
 def test_commonPrefix14(self):
     # Empty input list should generate empty result
     self.assertEqual(commonPrefix(), '')
Ejemplo n.º 9
0
 def test_commonPrefix9a(self):
     self.assertEqual(commonPrefix('a/b/..', 'a/b'), 'a')
Ejemplo n.º 10
0
 def test_commonPrefix8(self):
     self.assertEqual(commonPrefix(os.path.join('a', 'bc'), os.path.join('a', 'b')), 'a')
Ejemplo n.º 11
0
 def test_commonPrefix3(self):
     self.assertEqual(commonPrefix('', 'a'), '')
Ejemplo n.º 12
0
 def test_commonPrefix13(self):
     self.assertEqual(commonPrefix('aa\\bb', 'Aa\\bB'), os.path.join('aa', 'bb'))
Ejemplo n.º 13
0
 def test_commonPrefix14(self):
     # Empty input list should generate empty result
     self.assertEqual(commonPrefix(), '')
Ejemplo n.º 14
0
 def test_commonPrefix11a(self):
     # if any input directory is abs path, return abs commonprefix
     d1 = os.path.join(os.getcwd(), 'a1')
     self.assertEqual(commonPrefix(d1, 'a2'), os.path.normcase(os.getcwd()))
Ejemplo n.º 15
0
 def test_commonPrefix12a(self):
     # Cases like this only applies to Windows. Since Unix separator
     # is not '\\' but '/'. Unix will treat '\\' as part of file name.
     self.assertEqual(commonPrefix(os.path.join('a a', 'b b', 'c c'),
                                   os.path.join('a a', 'b b')), os.path.join('a a', 'b b'))
Ejemplo n.º 16
0
 def test_commonPrefix11(self):
     """Check that leading ../current_subdir will be removed after path
        clearnup."""
     # Get the name of the current directory
     d = os.path.basename(os.getcwd())
     self.assertEqual(commonPrefix('../' + d + '/a/b', 'a/b'), os.path.join('a', 'b'))
Ejemplo n.º 17
0
 def test_commonPrefix10a(self):
     self.assertEqual(commonPrefix('a/./b', 'a/b'), os.path.join('a', 'b'))
Ejemplo n.º 18
0
 def test_commonPrefix10(self):
     self.assertEqual(commonPrefix('a\\.\\b', 'a\\b'), os.path.join('a', 'b'))
Ejemplo n.º 19
0
 def test_commonPrefix10(self):
     self.assertEqual(commonPrefix('a\\.\\b', 'a\\b'),
                      os.path.join('a', 'b'))
Ejemplo n.º 20
0
 def test_commonPrefix15(self):
     # if current working directory is 'a/b', for ".." and "", what part is
     # the commonprefix? It should be an absolute path "a"
     self.assertEqual(commonPrefix('..', ''), os.path.normcase(os.path.dirname(os.getcwd())))
Ejemplo n.º 21
0
 def test_commonPrefix10a(self):
     self.assertEqual(commonPrefix('a/./b', 'a/b'), os.path.join('a', 'b'))
Ejemplo n.º 22
0
 def test_commonPrefix2(self):
     self.assertEqual(commonPrefix('a', 'b'), '')
Ejemplo n.º 23
0
 def test_commonPrefix11a(self):
     # if any input directory is abs path, return abs commonprefix
     d1 = os.path.join(os.getcwd(), 'a1')
     self.assertEqual(commonPrefix(d1, 'a2'), os.path.normcase(os.getcwd()))
Ejemplo n.º 24
0
 def test_commonPrefix2(self):
     self.assertEqual(commonPrefix('a', 'b'), '')
Ejemplo n.º 25
0
 def test_commonPrefix13(self):
     self.assertEqual(commonPrefix('aa\\bb', 'Aa\\bB'),
                      os.path.join('aa', 'bb'))
Ejemplo n.º 26
0
 def test_commonPrefix3(self):
     self.assertEqual(commonPrefix('', 'a'), '')
Ejemplo n.º 27
0
 def test_commonPrefix15(self):
     # if current working directory is 'a/b', for ".." and "", what part is
     # the commonprefix? It should be an absolute path "a"
     self.assertEqual(commonPrefix('..', ''),
                      os.path.normcase(os.path.dirname(os.getcwd())))
Ejemplo n.º 28
0
 def test_commonPrefix9(self):
     self.assertEqual(commonPrefix('a\\b\\..', 'a\\b'), 'a')