def test_get_not_repeated_file_name(self): path = data_mod.__path__[0] existing_file = os.path.join(path, "pdb_data.py") re_existing_file = os.path.join(path, "_pdb_data.py") non_existing_file = os.path.join(path, "nonexisting.txt") self.assertEquals(non_existing_file, get_not_repeated_file_name(non_existing_file)) self.assertEquals(re_existing_file, get_not_repeated_file_name(existing_file))
def test_get_not_repeated_file_name(self): path = data_mod.__path__[0] existing_file = os.path.join(path, "pdb_data.py") re_existing_file = os.path.join(path, "_pdb_data.py") non_existing_file = os.path.join(path, "nonexisting.txt") self.assertEquals(non_existing_file, get_not_repeated_file_name(non_existing_file)) self.assertEquals(re_existing_file, get_not_repeated_file_name(existing_file))
def save_to_disk(self, path_with_file_name): """ Saves itself as a binary file. @param filename: complete path with name of the file """ not_repeated_path_with_file_name = scriptTools.get_not_repeated_file_name(path_with_file_name) file_handler = open(not_repeated_path_with_file_name,'w') pickle.dump(self,file_handler) file_handler.close()
def test_get_not_repeated_file_name(self): existing_file = "data/pdb_data.py" re_existing_file = "data/_pdb_data.py" non_existing_file = "data/nonexisting.txt" self.assertEquals(non_existing_file, get_not_repeated_file_name(non_existing_file)) self.assertEquals(re_existing_file, get_not_repeated_file_name(existing_file))