示例#1
0
    def test_as_remote(self):
        filename = "G:\\local\\path\\to\\file"
        file = FilePath(filename)
        self.assertEqual("file:///remote/path/to/file",file.as_remote())

        filename = "file:///G:/local2/path/to/file"
        file = FilePath(filename)
        self.assertEqual("file:///remote2/path/to/file",file.as_remote())
示例#2
0
    def test_as_remote(self):
        filename = "/local/path/to/file"
        file = FilePath(filename)
        self.assertEqual("file:///G:/remote/path/to/file",file.as_remote())

        filename = "file:///local2/path/to/file"
        file = FilePath(filename)
        self.assertEqual("file:///G:/remote2/path/to/file",file.as_remote())
示例#3
0
    def test_as_local_with_uri(self):
        filename = "file:///remote1/path/to/file"
        file = FilePath(filename)
        self.assertEqual("/local1/path/to/file",file.as_local())

        filename = "file:///remote2/path/to/file"
        file = FilePath(filename)
        self.assertEqual("/local2/path/to/file",file.as_local())
示例#4
0
    def test_as_local(self):
        filename = "G:\\remote\\path\\to\\file"
        file = FilePath(filename)
        self.assertEqual("/local/path/to/file",file.as_local())

        filename = "file:///G:/remote2/path/to/file"
        file = FilePath(filename)
        self.assertEqual("/local2/path/to/file",file.as_local())
示例#5
0
    def test_as_remote_with_win_paths(self):
        filename = "C:/local1/path/to/file"
        file = FilePath(filename)
        self.assertEqual("file:///C:/remote1/path/to/file",file.as_remote())

        filename = "file:///C:/local2/path/to/file"
        file = FilePath(filename)
        self.assertEqual("file:///C:/remote2/path/to/file",file.as_remote())
示例#6
0
    def test_as_remote_with_win_paths(self):
        filename = "C:/local1/path/to/file"
        file = FilePath(filename)
        self.assertEqual("file:///C:/remote1/path/to/file", file.as_remote())

        filename = "file:///C:/local2/path/to/file"
        file = FilePath(filename)
        self.assertEqual("file:///C:/remote2/path/to/file", file.as_remote())
示例#7
0
    def test_as_remote(self):
        filename = "/local/path/to/file"
        file = FilePath(filename)
        self.assertEqual("file:///G:/remote/path/to/file", file.as_remote())

        filename = "file:///local2/path/to/file"
        file = FilePath(filename)
        self.assertEqual("file:///G:/remote2/path/to/file", file.as_remote())
示例#8
0
    def test_as_local(self):
        filename = "G:\\remote\\path\\to\\file"
        file = FilePath(filename)
        self.assertEqual("/local/path/to/file", file.as_local())

        filename = "file:///G:/remote2/path/to/file"
        file = FilePath(filename)
        self.assertEqual("/local2/path/to/file", file.as_local())
示例#9
0
    def test_as_local_with_uri(self):
        filename = "file:///remote1/path/to/file"
        file = FilePath(filename)
        self.assertEqual("/local1/path/to/file",file.as_local())

        filename = "file:///remote2/path/to/file"
        file = FilePath(filename)
        self.assertEqual("/local2/path/to/file",file.as_local())
示例#10
0
    def test_as_remote_with_backslashed_win_paths(self):
        filename = "C:\\local1\\path\\to\\file"
        file = FilePath(filename)
        self.assertEqual("file:///C:/remote1/path/to/file",file.as_remote())

        filename = "C:\\local2\\path\\to\\file"
        file = FilePath(filename)
        self.assertEqual("file:///C:/remote2/path/to/file",file.as_remote())

        filename = "C:/local2/path/to/file"
        file = FilePath(filename)
        self.assertEqual("C:\\local2\\path\\to\\file",file.as_local())
示例#11
0
 def test_neq(self):
     filename1 = "/home/user/some/path"
     file1 = FilePath(filename1)
     filename2 = "/home/user/some/other/path"
     file2 = FilePath(filename2)
     assert file1 != file2
示例#12
0
 def test_eq(self):
     filename = "/home/user/some/path"
     file1 = FilePath(filename)
     file2 = FilePath(filename)
     assert file1 == file2
示例#13
0
 def test_eq_false(self):
     filename1 = "/home/user/some/path"
     file1 = FilePath(filename1)
     filename2 = "/home/user/some/other/path"
     file2 = FilePath(filename2)
     self.assertFalse(file1 == file2)
示例#14
0
 def test_remote_prefix(self):
     prefix = "file://"
     filename = "/home/user/some/path"
     file = FilePath(prefix + filename)
     self.assertEqual(filename, file.as_local())
示例#15
0
 def test_as_remote(self):
     filename = "/home/user/some/path"
     file = FilePath(filename)
     self.assertEqual(filename, file.as_remote())
示例#16
0
 def test_remote_prefix(self):
     prefix = "file://"
     filename = "/home/user/some/path"
     file = FilePath(prefix+filename)
     self.assertEqual(filename,file.as_local())
示例#17
0
 def test_as_remote(self):
     filename = "/home/user/some/path"
     file = FilePath(filename)
     self.assertEqual(filename,file.as_remote())
示例#18
0
 def test_as_local_does_nothing(self):
     filename = "G:\\the\\path\\to\\file"
     file = FilePath(filename)
     self.assertEqual("G:\\the\\path\\to\\file",file.as_local())
示例#19
0
 def test_as_local_does_nothing(self):
     filename = "G:\\the\\path\\to\\file"
     file = FilePath(filename)
     self.assertEqual("G:\\the\\path\\to\\file", file.as_local())
示例#20
0
 def test_add_reverse(self):
     filename = "/user/some/path"
     file = FilePath(filename)
     prepend = "/home/"
     assert (prepend + file) == (prepend + filename)
示例#21
0
 def test_neq_false(self):
     filename = "/home/user/some/path"
     file1 = FilePath(filename)
     file2 = FilePath(filename)
     self.assertFalse(file1 != file2)
示例#22
0
 def test_as_local_does_nothing(self):
     filename = "/the/remote/path/to/file"
     file = FilePath(filename)
     self.assertEqual("/the/remote/path/to/file",file.as_local())
示例#23
0
 def test_add(self):
     filename = "/home/user/some/path"
     file = FilePath(filename)
     append = "/myfile.txt"
     assert (file + append) == (filename + append)
示例#24
0
 def test_quoted(self):
     quoted = "file:///home/user/file%2etcl"
     file = FilePath(quoted)
     self.assertEqual("/home/user/file.tcl",file.as_local())
示例#25
0
 def test_as_remote(self):
     filename = "/local/path/to/file"
     file = FilePath(filename)
     self.assertEqual("/remote/path/to/file", file)
示例#26
0
 def test_win(self):
     quoted = "file:///C:/home/user/file%2etcl"
     file = FilePath(quoted)
     self.assertEqual("C:\\home\\user\\file.tcl",file.as_local())