Skip to content

Commit 27c50c7

Browse files
committed
Test pjids
1 parent 7469abd commit 27c50c7

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

tests/workflows/tomo/test_tomo_picking.py

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from tests.conftest import ExampleVisit, get_or_create_db_entry
1717

1818

19-
def set_up_picking_db(murfey_db_session):
19+
def set_up_picking_db(murfey_db_session: Session):
2020
# Insert common elements needed in all picking tests
2121
dcg_entry: DataCollectionGroup = get_or_create_db_entry(
2222
murfey_db_session,
@@ -70,6 +70,44 @@ def set_up_picking_db(murfey_db_session):
7070
return dcg_entry.id, dc_entry.id, processing_job_entry.id
7171

7272

73+
def test_ids_tomo_classification(murfey_db_session: Session):
74+
dcg_id, first_dc, first_pj = set_up_picking_db(murfey_db_session)
75+
76+
# Insert a second data collection, processing job and autoproc program
77+
second_dc: DataCollection = get_or_create_db_entry(
78+
murfey_db_session,
79+
DataCollection,
80+
lookup_kwargs={
81+
"id": 1,
82+
"tag": "second_dc",
83+
"dcg_id": dcg_id,
84+
},
85+
)
86+
second_pj: ProcessingJob = get_or_create_db_entry(
87+
murfey_db_session,
88+
ProcessingJob,
89+
lookup_kwargs={
90+
"id": 10,
91+
"recipe": "second_recipe",
92+
"dc_id": second_dc.id,
93+
},
94+
)
95+
get_or_create_db_entry(
96+
murfey_db_session,
97+
AutoProcProgram,
98+
lookup_kwargs={
99+
"id": 11,
100+
"pj_id": second_pj.id,
101+
},
102+
)
103+
104+
returned_ids = picking._ids_tomo_classification(
105+
11, "test_recipe", murfey_db_session
106+
)
107+
assert returned_ids[0] == dcg_id
108+
assert returned_ids[1] == first_pj.id
109+
110+
73111
@mock.patch("murfey.workflows.tomo.picking._transport_object")
74112
@mock.patch("murfey.workflows.tomo.picking._ids_tomo_classification")
75113
def test_picked_tomogram_not_run_class2d(

0 commit comments

Comments
 (0)