Skip to content

Commit

Permalink
also make sure warning is logged
Browse files Browse the repository at this point in the history
  • Loading branch information
sroet committed Aug 7, 2024
1 parent c786f36 commit c8b6134
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions tests/test_tmjob.py
Original file line number Diff line number Diff line change
Expand Up @@ -643,14 +643,22 @@ def test_extraction(self):
msg="Length of returned list should be 0 after applying mask where the "
"object is not in the region of interest.",
)
# test if all masks are ignored if ignore_tomogram_mask=True
df, scores = extract_particles(
job,
5,
100,
tomogram_mask_path=TEST_EXTRACTION_MASK_OUTSIDE,
create_plot=False,
)
# test if all masks are ignored if ignore_tomogram_mask=True and that a warning is raised
with self.assertLogs(level="WARNING") as cm:
df, scores = extract_particles(
job,
5,
100,
tomogram_mask_path=TEST_EXTRACTION_MASK_OUTSIDE,
create_plot=False,
)
# Test if expected warning is logged
for o in cm.output:
if "Ignoring tomogram mask" in o:
break
else:
# break is not hit
self.fail("expected warning is not logged")
self.assertNotEqual(
len(scores),
0,
Expand Down

0 comments on commit c8b6134

Please sign in to comment.