示例#1
0
 def test_normalize_home_path_default(self):
     path = normalize_path(None, default='~/default.txt')
     self.assertEqual(normalize_path(path),
                      os.path.join(self.home_path, 'default.txt'))
示例#2
0
 def test_normalize_home_path(self):
     path = normalize_path('~/test.txt')
     self.assertEqual(normalize_path(path),
                      os.path.join(self.home_path, 'test.txt'))
示例#3
0
 def test_normalize_home_path_ignore_default(self):
     path = normalize_path('~/test.txt', default='~/default.txt')
     self.assertEqual(normalize_path(path),
                      os.path.join(self.home_path, 'test.txt'))
示例#4
0
 def test_normalize_relative_path_parent_dir(self):
     path = normalize_path('../test.txt')
     self.assertEqual(
         normalize_path(path),
         os.path.join(os.path.dirname(self.root_path), 'test.txt'))
示例#5
0
 def test_normalize_relative_path_default(self):
     path = normalize_path(None, default='default.txt')
     self.assertEqual(normalize_path(path),
                      os.path.join(self.root_path, 'default.txt'))
示例#6
0
 def test_normalize_relative_path_the_same_dir(self):
     path = normalize_path('./test.txt')
     self.assertEqual(normalize_path(path),
                      os.path.join(self.root_path, 'test.txt'))
示例#7
0
 def test_normalize_abs_path_default(self):
     path = normalize_path(None, default='/tmp/default.txt')
     self.assertEqual(normalize_path(path), '/tmp/default.txt')
示例#8
0
 def test_normalize_abs_path_ignore_default(self):
     path = normalize_path('/tmp/test.txt', default='/tmp/default.txt')
     self.assertEqual(normalize_path(path), '/tmp/test.txt')
示例#9
0
 def test_normalize_abs_path(self):
     path = normalize_path('/tmp/test.txt')
     self.assertEqual(normalize_path(path), '/tmp/test.txt')
示例#10
0
 def test_normalize_none_path(self):
     self.assertIsNone(normalize_path(None))