Added unit test for parasitic error
This commit is contained in:
parent
e3a17240db
commit
773f19ee36
2 changed files with 11 additions and 1 deletions
|
|
@ -69,7 +69,7 @@ class ParasiticMotionError(Exception):
|
|||
pass
|
||||
|
||||
|
||||
def parasitic_detect(delta: float, max_allowed_delta: float) -> None:
|
||||
def _parasitic_detect(delta: float, max_allowed_delta: float) -> None:
|
||||
"""Compare two values and raise parasitic motion error."""
|
||||
if delta > max_allowed_delta:
|
||||
raise ParasiticMotionError(
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
"""File contains unit tests for stage_measure."""
|
||||
|
||||
import pytest
|
||||
from openflexure_microscope_server.things.stage_measure import (
|
||||
_generate_move_dicts,
|
||||
_predict_z,
|
||||
_parasitic_detect,
|
||||
ParasiticMotionError
|
||||
)
|
||||
|
||||
from .mock_things.mock_csm import MockCSMThing
|
||||
|
|
@ -45,3 +48,10 @@ def test_predict_z():
|
|||
)
|
||||
expected_z_diff = 1343.1625053206606
|
||||
assert mock_z_diff == expected_z_diff
|
||||
|
||||
def test_parasitic_detect():
|
||||
"""Check that the parasitic error is raised correctly."""
|
||||
mock_delta = 100
|
||||
mock_max = 50
|
||||
with pytest.raises(ParasiticMotionError):
|
||||
_parasitic_detect(delta=mock_delta, max_allowed_delta=mock_max)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue