Skip to content

Commit

Permalink
More testing
Browse files Browse the repository at this point in the history
  • Loading branch information
frostedoyster committed Sep 7, 2024
1 parent fe8e536 commit 112ed89
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/utils/test_composition.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,3 +367,29 @@ def test_composition_model_missing_types():
match="do not contain atomic types",
):
composition_model.train_model(dataset)


def test_composition_model_wrong_target():
"""
Test the error when a non-energy is fed to the composition model.
"""

with pytest.raises(
ValueError,
match="only supports energy-like outputs",
):
CompositionModel(
model_hypers={},
dataset_info=DatasetInfo(
length_unit="angstrom",
atomic_types=[1],
targets=TargetInfoDict(
{
"energy": TargetInfo(
quantity="FOO",
per_atom=False,
)
}
),
),
)

0 comments on commit 112ed89

Please sign in to comment.