Skip to content

Commit 62391ec

Browse files
committed
tests: update tests
1 parent f30991b commit 62391ec

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from cellseg_models_pytorch.utils import FileHandler
22

33

4-
def test_filehandler(inst_map, type_map) -> None:
4+
def test_filehandler_get_gson(inst_map, type_map) -> None:
55
split_dict = FileHandler.get_offset("x-5000_y-3000")
66
assert "x" in split_dict.keys() and "y" in split_dict.keys()
77
assert 3000 in split_dict.values() and 5000 in split_dict.values()
@@ -10,3 +10,9 @@ def test_filehandler(inst_map, type_map) -> None:
1010
inst_map, type_map, classes={"a": 0, "b": 1, "c": 2, "d": 3}
1111
)
1212
assert len(gson) == 7
13+
14+
15+
def test_filehandler_read_h5(hdf5db):
16+
arrs = FileHandler.read_h5_patch(hdf5db, ix=1, return_type=True, return_sem=True)
17+
18+
assert arrs["image"].any()

cellseg_models_pytorch/utils/tests/test_seg_benchmark.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pytest
22

3-
from cellseg_models_pytorch.utils.seg_benchmark import BenchMarker
3+
from cellseg_models_pytorch.utils.seg_benchmark import SegBenchmarker
44

55
classes = {
66
"0": 0,
@@ -14,10 +14,16 @@
1414

1515

1616
@pytest.mark.parametrize("how", ["binary", "multi", None])
17-
def test_sem_seg_bm(mask_patch_dir, how):
18-
bm = BenchMarker(
19-
pred_dir=mask_patch_dir,
20-
true_dir=mask_patch_dir,
17+
@pytest.mark.parametrize("inputf", ["h5", "folder"])
18+
def test_sem_seg_bm(mask_patch_dir, hdf5db, how, inputf):
19+
if inputf == "folder":
20+
inpath = mask_patch_dir
21+
else:
22+
inpath = hdf5db
23+
24+
bm = SegBenchmarker(
25+
true_path=inpath,
26+
pred_path=inpath,
2127
type_classes=classes,
2228
sem_classes=classes,
2329
)

0 commit comments

Comments
 (0)