def test_returns_requested_file(self): path = "./files/bulk_water/classical" suffix = "pdb" prefix = "revPBE0-D3-w64-T300K-1bar" file_name = utils.get_path_to_file(path, suffix, prefix) assert file_name == os.path.join(path, "revPBE0-D3-w64-T300K-1bar.pdb")
def test_returns_all_files_with_same_suffix(self): path = "./files/bulk_water/classical" suffix = "pdb" file_names = utils.get_path_to_file(path, suffix) assert file_names == [ os.path.join(path, "PBE-D3-bnnt-w68-T330K-1bar.pdb"), os.path.join(path, "PBE-D3-cnt-w65-T330K-1bar.pdb"), os.path.join(path, "revPBE0-D3-w64-T300K-1bar.pdb"), ]
def test_returns_all_files_containing_same_string_in_prefix(self): path = "./files/bulk_water/classical" suffix = "pdb" prefix = "T330K" file_names = utils.get_path_to_file(path, suffix, prefix, exact_match=False) assert file_names == [ os.path.join(path, "PBE-D3-bnnt-w68-T330K-1bar.pdb"), os.path.join(path, "PBE-D3-cnt-w65-T330K-1bar.pdb"), ]
def test_raises_error_when_path_not_found(self): path = "./files/bulk_water/classical" suffix = "random_suffix" with pytest.raises(utils.UnableToFindFile): utils.get_path_to_file(path, suffix)