Skip to content

Commit

Permalink
improve unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
ychiucco committed Jan 15, 2025
1 parent c18194c commit f1d067f
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/v2/04_runner/test_unit_aux_functions_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
)
from fractal_server.app.runner.v2.task_interface import InitArgsModel
from fractal_server.app.runner.v2.task_interface import TaskOutput
from fractal_server.images import SingleImageTaskOutput


def test_deduplicate_list_of_dicts():
Expand Down Expand Up @@ -116,3 +117,28 @@ def test_merge_outputs():
# 4
merged = merge_outputs([])
assert merged == TaskOutput()

# 5
task_outputs = [
TaskOutput(
image_list_updates=[
SingleImageTaskOutput(zarr_url="/a"),
SingleImageTaskOutput(zarr_url="/b"),
],
image_list_removals=["/x", "/y", "/z"],
),
TaskOutput(
image_list_updates=[
SingleImageTaskOutput(zarr_url="/c"),
SingleImageTaskOutput(zarr_url="/a"),
],
image_list_removals=["/x", "/y", "/z"],
),
]
merged = merge_outputs(task_outputs)
assert merged.image_list_updates == [
SingleImageTaskOutput(zarr_url="/a"),
SingleImageTaskOutput(zarr_url="/b"),
SingleImageTaskOutput(zarr_url="/c"),
]
assert merged.image_list_removals == ["/x", "/y", "/z", "/x", "/y", "/z"]

0 comments on commit f1d067f

Please sign in to comment.