preferred way to say that something needs to be implemented

This commit is contained in:
Martin Diehl 2021-05-29 10:54:34 +02:00
parent f435a1bea4
commit 94b6be4e83
2 changed files with 6 additions and 4 deletions

View File

@ -162,11 +162,11 @@ class Config(dict):
@abc.abstractmethod
def is_complete(self):
"""Check for completeness."""
pass
raise NotImplementedError
@property
@abc.abstractmethod
def is_valid(self):
"""Check for valid file layout."""
pass
raise NotImplementedError

View File

@ -49,10 +49,12 @@ class TestConfig:
assert Config({'A':np.ones(3,'i')}).__repr__() == Config({'A':[1,1,1]}).__repr__()
def test_abstract_is_valid(self):
assert Config().is_valid is None
with pytest.raises(NotImplementedError):
Config().is_valid
def test_abstract_is_complete(self):
assert Config().is_complete is None
with pytest.raises(NotImplementedError):
Config().is_complete
@pytest.mark.parametrize('data',[Rotation.from_random(),Orientation.from_random(lattice='cI')])
def test_rotation_orientation(self,data):