test(mri/model): drop redundant caplog.at_level (direct handler attach is the actual mechanism)
Browse files
tests/models/test_mri_model.py
CHANGED
|
@@ -56,8 +56,6 @@ class TestMRIDLModel:
|
|
| 56 |
def test_predict_warns_on_label_count_mismatch(
|
| 57 |
self, tmp_path: Path, caplog: pytest.LogCaptureFixture
|
| 58 |
) -> None:
|
| 59 |
-
import logging
|
| 60 |
-
|
| 61 |
artifact = build_dummy_mri_onnx(tmp_path / "mri_model.onnx")
|
| 62 |
model = mri_model.load(artifact)
|
| 63 |
|
|
@@ -65,13 +63,12 @@ class TestMRIDLModel:
|
|
| 65 |
# caplog root handler never sees its records. Attach caplog.handler directly.
|
| 66 |
mri_model.logger.addHandler(caplog.handler)
|
| 67 |
try:
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
)
|
| 75 |
finally:
|
| 76 |
mri_model.logger.removeHandler(caplog.handler)
|
| 77 |
|
|
|
|
| 56 |
def test_predict_warns_on_label_count_mismatch(
|
| 57 |
self, tmp_path: Path, caplog: pytest.LogCaptureFixture
|
| 58 |
) -> None:
|
|
|
|
|
|
|
| 59 |
artifact = build_dummy_mri_onnx(tmp_path / "mri_model.onnx")
|
| 60 |
model = mri_model.load(artifact)
|
| 61 |
|
|
|
|
| 63 |
# caplog root handler never sees its records. Attach caplog.handler directly.
|
| 64 |
mri_model.logger.addHandler(caplog.handler)
|
| 65 |
try:
|
| 66 |
+
result = mri_model.predict_nifti(
|
| 67 |
+
model,
|
| 68 |
+
_FIXTURE_MRI,
|
| 69 |
+
target_shape=(8, 8, 8),
|
| 70 |
+
label_names=("control", "abnormal", "extra"),
|
| 71 |
+
)
|
|
|
|
| 72 |
finally:
|
| 73 |
mri_model.logger.removeHandler(caplog.handler)
|
| 74 |
|