Starting to test more smart scan functionality using mocked Thing Dependencies
This commit is contained in:
parent
3aa9b9100a
commit
7193ec34f5
7 changed files with 184 additions and 1 deletions
0
tests/mock_things/__init__.py
Normal file
0
tests/mock_things/__init__.py
Normal file
17
tests/mock_things/mock_autofocus.py
Normal file
17
tests/mock_things/mock_autofocus.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
"""This testing submodule contains mock autofocus things.
|
||||
|
||||
These mocks are designed to be inserted as dependencies to give specific
|
||||
functionality and returns.
|
||||
|
||||
The mocks do not subclass, and instead return very specific defined answers
|
||||
to functions
|
||||
"""
|
||||
|
||||
|
||||
class MockAutoFocusThing:
|
||||
# Counter for checking functions were called
|
||||
mock_call_count = {"looping_autofocus": 0}
|
||||
|
||||
def looping_autofocus(self, dz=2000, start="centre"): # noqa: ARG002
|
||||
"""This function mocks autofocus with no return"""
|
||||
self.mock_call_count["looping_autofocus"] += 1
|
||||
20
tests/mock_things/mock_background_detect.py
Normal file
20
tests/mock_things/mock_background_detect.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
"""This testing submodule contains mock autofocus things.
|
||||
|
||||
These mocks are designed to be inserted as dependencies to give specific
|
||||
functionality and returns.
|
||||
|
||||
The mocks do not subclass, and instead return very specific defined answers
|
||||
to functions
|
||||
"""
|
||||
|
||||
from openflexure_microscope_server.things.background_detect import ChannelDistributions
|
||||
|
||||
|
||||
class MockBackgoundDetectThing:
|
||||
# Counter for checking functions were called
|
||||
|
||||
background_distributions = ChannelDistributions(
|
||||
means=[128.0, 128.0, 128.0],
|
||||
standard_deviations=[3.0, 3.0, 3.0],
|
||||
colorspace="LUV",
|
||||
)
|
||||
12
tests/mock_things/mock_csm.py
Normal file
12
tests/mock_things/mock_csm.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
"""This testing submodule contains mock camera stage mapping things.
|
||||
|
||||
These mocks are designed to be inserted as dependencies to give specific
|
||||
functionality and returns.
|
||||
|
||||
The mocks do not subclass, and instead return very specific defined answers
|
||||
to functions
|
||||
"""
|
||||
|
||||
|
||||
class MockCSMThing:
|
||||
image_resolution = (123, 456)
|
||||
12
tests/mock_things/mock_stage.py
Normal file
12
tests/mock_things/mock_stage.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
"""This testing submodule contains stage things.
|
||||
|
||||
These mocks are designed to be inserted as dependencies to give specific
|
||||
functionality and returns.
|
||||
|
||||
The mocks do not subclass, and instead return very specific defined answers
|
||||
to functions
|
||||
"""
|
||||
|
||||
|
||||
class MockStageThing:
|
||||
position = (111, 222, 333)
|
||||
Loading…
Add table
Add a link
Reference in a new issue