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