def test_delete(self): File.copy('testResources\\FileTest.txt', "testResources\\FileTestTemp.txt") self.assertTrue(File.exists("testResources\\FileTestTemp.txt")) File.delete("testResources\\FileTestTemp.txt") self.assertFalse(File.exists("testResources\\FileTestTemp.txt")) pass
def test_exists(self): self.assertTrue(File.exists(r'testResources\FileTest.txt')) self.assertFalse(File.exists(r'testResources\FILEDOESNOTEXIST.txt'))
def get_resource_path(resource): # TODO: write unit test if File.exists(Path.combine(Path.get_file_path(__file__), resource)): return Path.combine(Path.get_file_path(__file__), resource) else: raise Exception('The given resource could not be found')