Squash final todos for SmartScan refactor
This commit is contained in:
parent
7d83aadf8d
commit
f9fcdf628b
6 changed files with 62 additions and 40 deletions
|
|
@ -45,7 +45,7 @@ def _fake_scan_data(**kwargs) -> ScanData:
|
|||
"start_time": copy(MOCK_START_TIME),
|
||||
"skip_background": True,
|
||||
"stitch_automatically": True,
|
||||
"stitch_resize": 0.25,
|
||||
"correlation_resize": 0.25,
|
||||
"save_resolution": (1000, 1000),
|
||||
}
|
||||
for key, value in kwargs.items():
|
||||
|
|
@ -79,7 +79,7 @@ def test_custom_serialisation():
|
|||
scan_data = _fake_scan_data()
|
||||
# Serialise to string then load directly as json
|
||||
scan_data_dict = json.loads(scan_data.model_dump_json())
|
||||
assert scan_data_dict["start_time"] == "11_00_00-25_12_2024"
|
||||
assert scan_data_dict["start_time"] == "2024-12-25_11:00:00"
|
||||
assert scan_data_dict["image_count"] == 0
|
||||
assert scan_data_dict["duration"] == "Unknown"
|
||||
assert scan_data_dict["scan_result"] == "Unknown"
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@ def _expected_scan_data():
|
|||
"autofocus_on": True,
|
||||
"skip_background": True,
|
||||
"stitch_automatically": True,
|
||||
"stitch_resize": 0.5,
|
||||
"correlation_resize": 0.5,
|
||||
"save_resolution": (1640, 1232),
|
||||
}
|
||||
return ScanData(start_time=datetime.now(), **expected_dict)
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import logging
|
|||
import os
|
||||
from copy import copy
|
||||
import uuid
|
||||
import re
|
||||
import threading
|
||||
from time import sleep
|
||||
|
||||
|
|
@ -229,19 +228,15 @@ def test_final_stitching_command(caplog, mocker):
|
|||
)
|
||||
# For the final stitcher it will always complete before returning.
|
||||
stitcher.start(cancel=lt.deps.CancelHook(id=uuid.uuid4()))
|
||||
# The mock command logs the inputs so should be 1 less than
|
||||
# FINAL_EXPECTED_COMMAND as the command itself is not logged. However, there
|
||||
# is two extra logs, The date (before the program starts) and
|
||||
# "Stitching complete" when it ends.
|
||||
assert len(caplog.records) == len(FINAL_EXPECTED_COMMAND) + 1
|
||||
# The mock command logs the inputs (but not the initial command) and the
|
||||
# stitcher logs # "Stitching complete" when it ends.
|
||||
assert len(caplog.records) == len(FINAL_EXPECTED_COMMAND)
|
||||
for i, record in enumerate(caplog.records):
|
||||
msg = record.message
|
||||
if i == 0:
|
||||
assert re.match(r"^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}", msg)
|
||||
elif i == len(FINAL_EXPECTED_COMMAND):
|
||||
assert msg.strip() == "Stitching complete"
|
||||
msg = record.message.strip()
|
||||
if i == len(FINAL_EXPECTED_COMMAND) - 1:
|
||||
assert msg == "Stitching complete"
|
||||
else:
|
||||
assert msg.strip() == FINAL_EXPECTED_COMMAND[i]
|
||||
assert msg == FINAL_EXPECTED_COMMAND[i + 1]
|
||||
|
||||
|
||||
def test_final_stitching_command_cancelled(caplog, mocker):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue