Skip to content

Commit

Permalink
Updated tests with new container types
Browse files Browse the repository at this point in the history
  • Loading branch information
Esben Jannik Bjerrum committed Mar 7, 2024
1 parent a6ac478 commit 84d1315
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ def smiles_list():

_CONTAINER_CREATORS = [
lambda x: x,
lambda x: np.array(x),
lambda x: np.array(x).reshape(-1, 1),
lambda x: pd.Series(x),
lambda x: pd.DataFrame({"hello": x}),
]

Expand Down
10 changes: 7 additions & 3 deletions tests/test_smilestomol.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,14 @@ def test_smilestomol_unsanitzable(invalid_smiles_list, smilestomol_transformer):
with pytest.raises(ValueError):
smilestomol_transformer.transform(invalid_smiles_list)

def test_descriptor_transformer_parallel(smiles_list, smilestomol_transformer):
def test_descriptor_transformer_parallel(smiles_container, smilestomol_transformer):
smilestomol_transformer.set_params(parallel=True)
mol_list = smilestomol_transformer.transform(smiles_list)
assert all([ a == b for a, b in zip(smiles_list, [Chem.MolToSmiles(mol) for mol in mol_list.flatten()])])
mol_list = smilestomol_transformer.transform(smiles_container)
if isinstance(smiles_container, pd.DataFrame):
expected_smiles = smiles_container.iloc[:, 0].tolist()
else:
expected_smiles = smiles_container
assert all([ a == b for a, b in zip(expected_smiles, [Chem.MolToSmiles(mol) for mol in mol_list.flatten()])])

def test_pandas_output(smiles_container, smilestomol_transformer, pandas_output):
mols = smilestomol_transformer.transform(smiles_container)
Expand Down

0 comments on commit 84d1315

Please sign in to comment.