Skip to content

Commit

Permalink
More tweakage and testing
Browse files Browse the repository at this point in the history
  • Loading branch information
mbercx committed May 11, 2021
1 parent ae57f10 commit f8c9469
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion aiida_pseudo/cli/params/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def __init__(self, quantity: typing.Optional[typing.List[str]] = None, **kwargs)
self.quantity = quantity

def convert(self, value, _, __):
"""Check if the provided unit is a valid energy unit.
"""Check if the provided unit is a valid unit for the defined quantity.
:raises: `click.BadParameter` if the provided unit is not valid for the quantity defined for this instance.
"""
Expand Down
4 changes: 4 additions & 0 deletions aiida_pseudo/groups/mixins/cutoffs.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@ def set_default_stringency(self, default_stringency: str) -> None:
:param default_stringency: the default stringency to be used for the recommended cutoffs.
:raises ValueError: if the provided default stringency is not in the tuple of available cutoff stringencies for
the pseudo family.
:raises ValueError: if the user tries to unset the stringency by providing ``None`` as an input.
"""
if default_stringency is None:
raise ValueError('the default stringency cannot be unset.')

self.validate_stringency(default_stringency)
self.set_extra(self._key_default_stringency, default_stringency)

Expand Down
3 changes: 3 additions & 0 deletions tests/groups/mixins/test_cutoffs.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ def test_set_default_stringency(get_pseudo_family, generate_cutoffs_dict):

assert family.get_default_stringency() == 'low'

with pytest.raises(ValueError, match=r'the default stringency cannot be unset'):
family.set_default_stringency(None)

with pytest.raises(ValueError, match=r'stringency `nonexistent` is not one of the available cutoff stringencies'):
family.set_default_stringency('nonexistent')

Expand Down

0 comments on commit f8c9469

Please sign in to comment.