Skip to content

Commit 9b29882

Browse files
committed
Mocking count didn't work
1 parent d679771 commit 9b29882

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

tests/workflows/tomo/test_tomo_picking.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,11 @@ def test_picked_tomogram_not_run_class2d(
152152

153153
@mock.patch("murfey.workflows.tomo.picking._transport_object")
154154
@mock.patch("murfey.workflows.tomo.picking._ids_tomo_classification")
155-
@mock.patch("murfey.workflows.tomo.picking.func")
156155
def test_picked_tomogram_run_class2d_with_diameter(
157-
mock_func, mock_ids, mock_transport, murfey_db_session: Session, tmp_path
156+
mock_ids, mock_transport, murfey_db_session: Session, tmp_path
158157
):
159158
"""Run the picker feedback with a pre-determined particle diameter"""
160159
mock_transport.feedback_queue = "murfey_feedback"
161-
mock_func.count.return_value = 10001
162160

163161
# Insert table dependencies
164162
dcg_id, dc_id, pj_id = set_up_picking_db(murfey_db_session)
@@ -175,7 +173,7 @@ def test_picked_tomogram_run_class2d_with_diameter(
175173
"particle_diameter": 200,
176174
},
177175
)
178-
for particle in range(10):
176+
for particle in range(10001):
179177
get_or_create_db_entry(
180178
murfey_db_session,
181179
ParticleSizes,
@@ -201,7 +199,6 @@ def test_picked_tomogram_run_class2d_with_diameter(
201199
picking._register_picked_tomogram_use_diameter(message, murfey_db_session)
202200

203201
mock_ids.assert_called_once_with(0, "em-tomo-class2d", murfey_db_session)
204-
mock_func.count.assert_called_once()
205202

206203
tomograms_db = murfey_db_session.exec(
207204
select(TomogramPicks).where(TomogramPicks.pj_id == 1)
@@ -239,13 +236,11 @@ def test_picked_tomogram_run_class2d_with_diameter(
239236

240237
@mock.patch("murfey.workflows.tomo.picking._transport_object")
241238
@mock.patch("murfey.workflows.tomo.picking._ids_tomo_classification")
242-
@mock.patch("murfey.workflows.tomo.picking.func")
243239
def test_picked_tomogram_run_class2d_estimate_diameter(
244-
mock_func, mock_ids, mock_transport, murfey_db_session: Session, tmp_path
240+
mock_ids, mock_transport, murfey_db_session: Session, tmp_path
245241
):
246242
"""Run the picker feedback for Class2D, including diameter estimation"""
247243
mock_transport.feedback_queue = "murfey_feedback"
248-
mock_func.count.return_value = 10001
249244

250245
# Insert table dependencies
251246
dcg_id, dc_id, pj_id = set_up_picking_db(murfey_db_session)
@@ -262,7 +257,7 @@ def test_picked_tomogram_run_class2d_estimate_diameter(
262257
"particle_diameter": None,
263258
},
264259
)
265-
for particle in range(10):
260+
for particle in range(10001):
266261
get_or_create_db_entry(
267262
murfey_db_session,
268263
ParticleSizes,
@@ -300,7 +295,6 @@ def test_picked_tomogram_run_class2d_estimate_diameter(
300295
picking._register_picked_tomogram_use_diameter(message, murfey_db_session)
301296

302297
mock_ids.assert_called_once_with(0, "em-tomo-class2d", murfey_db_session)
303-
mock_func.count.assert_called_once()
304298

305299
# Two mock calls - one flushed tomogram and one new
306300
assert mock_transport.send.call_count == 2

0 commit comments

Comments
 (0)