|
16 | 16 | from tests.conftest import ExampleVisit, get_or_create_db_entry |
17 | 17 |
|
18 | 18 |
|
19 | | -def set_up_picking_db(murfey_db_session): |
| 19 | +def set_up_picking_db(murfey_db_session: Session): |
20 | 20 | # Insert common elements needed in all picking tests |
21 | 21 | dcg_entry: DataCollectionGroup = get_or_create_db_entry( |
22 | 22 | murfey_db_session, |
@@ -70,6 +70,44 @@ def set_up_picking_db(murfey_db_session): |
70 | 70 | return dcg_entry.id, dc_entry.id, processing_job_entry.id |
71 | 71 |
|
72 | 72 |
|
| 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 | + |
73 | 111 | @mock.patch("murfey.workflows.tomo.picking._transport_object") |
74 | 112 | @mock.patch("murfey.workflows.tomo.picking._ids_tomo_classification") |
75 | 113 | def test_picked_tomogram_not_run_class2d( |
|
0 commit comments