コード例 #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
ファイル: test_preview_utils.py プロジェクト: freason/enki
 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
ファイル: test_preview_utils.py プロジェクト: freason/enki
 def test_commonPrefix9a(self):
     self.assertEqual(commonPrefix('a/b/..', 'a/b'), 'a')
コード例 #10
0
ファイル: test_preview_utils.py プロジェクト: freason/enki
 def test_commonPrefix8(self):
     self.assertEqual(commonPrefix(os.path.join('a', 'bc'), os.path.join('a', 'b')), 'a')
コード例 #11
0
ファイル: test_preview_utils.py プロジェクト: freason/enki
 def test_commonPrefix3(self):
     self.assertEqual(commonPrefix('', 'a'), '')
コード例 #12
0
ファイル: test_preview_utils.py プロジェクト: freason/enki
 def test_commonPrefix13(self):
     self.assertEqual(commonPrefix('aa\\bb', 'Aa\\bB'), os.path.join('aa', 'bb'))
コード例 #13
0
ファイル: test_preview_utils.py プロジェクト: freason/enki
 def test_commonPrefix14(self):
     # Empty input list should generate empty result
     self.assertEqual(commonPrefix(), '')
コード例 #14
0
ファイル: test_preview_utils.py プロジェクト: freason/enki
 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
ファイル: test_preview_utils.py プロジェクト: freason/enki
 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
ファイル: test_preview_utils.py プロジェクト: freason/enki
 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
ファイル: test_preview_utils.py プロジェクト: freason/enki
 def test_commonPrefix10a(self):
     self.assertEqual(commonPrefix('a/./b', 'a/b'), os.path.join('a', 'b'))
コード例 #18
0
ファイル: test_preview_utils.py プロジェクト: freason/enki
 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
ファイル: test_preview_utils.py プロジェクト: freason/enki
 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
ファイル: test_preview_utils.py プロジェクト: freason/enki
 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
ファイル: test_preview_utils.py プロジェクト: freason/enki
 def test_commonPrefix9(self):
     self.assertEqual(commonPrefix('a\\b\\..', 'a\\b'), 'a')