Пример #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'))
Пример #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'))
Пример #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'))))
Пример #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'))))
Пример #5
0
 def test_commonPrefix9a(self):
     self.assertEqual(commonPrefix('a/b/..', 'a/b'), 'a')
Пример #6
0
 def test_commonPrefix8(self):
     self.assertEqual(
         commonPrefix(os.path.join('a', 'bc'), os.path.join('a', 'b')), 'a')
Пример #7
0
 def test_commonPrefix9(self):
     self.assertEqual(commonPrefix('a\\b\\..', 'a\\b'), 'a')
Пример #8
0
 def test_commonPrefix14(self):
     # Empty input list should generate empty result
     self.assertEqual(commonPrefix(), '')
Пример #9
0
 def test_commonPrefix9a(self):
     self.assertEqual(commonPrefix('a/b/..', 'a/b'), 'a')
Пример #10
0
 def test_commonPrefix8(self):
     self.assertEqual(commonPrefix(os.path.join('a', 'bc'), os.path.join('a', 'b')), 'a')
Пример #11
0
 def test_commonPrefix3(self):
     self.assertEqual(commonPrefix('', 'a'), '')
Пример #12
0
 def test_commonPrefix13(self):
     self.assertEqual(commonPrefix('aa\\bb', 'Aa\\bB'), os.path.join('aa', 'bb'))
Пример #13
0
 def test_commonPrefix14(self):
     # Empty input list should generate empty result
     self.assertEqual(commonPrefix(), '')
Пример #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()))
Пример #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'))
Пример #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'))
Пример #17
0
 def test_commonPrefix10a(self):
     self.assertEqual(commonPrefix('a/./b', 'a/b'), os.path.join('a', 'b'))
Пример #18
0
 def test_commonPrefix10(self):
     self.assertEqual(commonPrefix('a\\.\\b', 'a\\b'), os.path.join('a', 'b'))
Пример #19
0
 def test_commonPrefix10(self):
     self.assertEqual(commonPrefix('a\\.\\b', 'a\\b'),
                      os.path.join('a', 'b'))
Пример #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())))
Пример #21
0
 def test_commonPrefix10a(self):
     self.assertEqual(commonPrefix('a/./b', 'a/b'), os.path.join('a', 'b'))
Пример #22
0
 def test_commonPrefix2(self):
     self.assertEqual(commonPrefix('a', 'b'), '')
Пример #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()))
Пример #24
0
 def test_commonPrefix2(self):
     self.assertEqual(commonPrefix('a', 'b'), '')
Пример #25
0
 def test_commonPrefix13(self):
     self.assertEqual(commonPrefix('aa\\bb', 'Aa\\bB'),
                      os.path.join('aa', 'bb'))
Пример #26
0
 def test_commonPrefix3(self):
     self.assertEqual(commonPrefix('', 'a'), '')
Пример #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())))
Пример #28
0
 def test_commonPrefix9(self):
     self.assertEqual(commonPrefix('a\\b\\..', 'a\\b'), 'a')