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'))
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'))
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'))))
def test_commonPrefix9a(self): self.assertEqual(commonPrefix('a/b/..', 'a/b'), 'a')
def test_commonPrefix8(self): self.assertEqual( commonPrefix(os.path.join('a', 'bc'), os.path.join('a', 'b')), 'a')
def test_commonPrefix9(self): self.assertEqual(commonPrefix('a\\b\\..', 'a\\b'), 'a')
def test_commonPrefix14(self): # Empty input list should generate empty result self.assertEqual(commonPrefix(), '')
def test_commonPrefix8(self): self.assertEqual(commonPrefix(os.path.join('a', 'bc'), os.path.join('a', 'b')), 'a')
def test_commonPrefix3(self): self.assertEqual(commonPrefix('', 'a'), '')
def test_commonPrefix13(self): self.assertEqual(commonPrefix('aa\\bb', 'Aa\\bB'), os.path.join('aa', 'bb'))
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()))
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'))
def test_commonPrefix10a(self): self.assertEqual(commonPrefix('a/./b', 'a/b'), os.path.join('a', 'b'))
def test_commonPrefix10(self): self.assertEqual(commonPrefix('a\\.\\b', 'a\\b'), os.path.join('a', 'b'))
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())))
def test_commonPrefix2(self): self.assertEqual(commonPrefix('a', 'b'), '')