Improve NeighborList tests.
This commit is contained in:
parent
2643975c3c
commit
4e0d00098c
@ -147,7 +147,7 @@ class NeighborList(collections.abc.Sequence):
|
||||
self._idx += offset
|
||||
self._idx %= len(self.items)
|
||||
new = self.curitem()
|
||||
elif self._mode == self.Modes.exception:
|
||||
elif self._mode == self.Modes.exception: # pragma: no branch
|
||||
raise
|
||||
else:
|
||||
self._idx += offset
|
||||
|
@ -51,6 +51,11 @@ class TestInit:
|
||||
assert 2 in nl
|
||||
assert 4 not in nl
|
||||
|
||||
def test_invalid_mode(self):
|
||||
"""Test with an invalid mode."""
|
||||
with pytest.raises(TypeError):
|
||||
usertypes.NeighborList(mode='blah')
|
||||
|
||||
|
||||
class TestDefaultArg:
|
||||
|
||||
@ -71,6 +76,12 @@ class TestDefaultArg:
|
||||
nl = usertypes.NeighborList([1, 2, 3])
|
||||
assert nl._idx is None
|
||||
|
||||
def test_invalid_reset(self):
|
||||
"""Test reset without default."""
|
||||
nl = usertypes.NeighborList([1, 2, 3, 4, 5])
|
||||
with pytest.raises(ValueError):
|
||||
nl.reset()
|
||||
|
||||
|
||||
class TestEmpty:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user