def it_can_constructs_slides(self, request, tmpdir, Slide_): tmp_path_ = tmpdir.mkdir("myslide") slides_ = method_mock(request, SlideSet, "__iter__") slides_.return_value = [Slide_ for _ in range(10)] slideset = SlideSet(tmp_path_, os.path.join(tmp_path_, "b"), [".svs"]) slides = slideset.__iter__() slides_.assert_called_once_with(slideset) assert len(slides) == 10
def it_constructs_its_sequence_of_slides_to_help(self, tmpdir): tmp_path_ = tmpdir.mkdir("myslide") image = PILIMG.RGBA_COLOR_500X500_155_249_240 image.save(os.path.join(tmp_path_, "mywsi.svs"), "TIFF") image2 = PILIMG.RGBA_COLOR_50X50_155_0_0 image2.save(os.path.join(tmp_path_, "mywsi2.svs"), "TIFF") slideset = SlideSet(tmp_path_, "proc", [".svs"]) expected_slides = [ Slide(os.path.join(tmp_path_, _path), "proc") for _path in os.listdir(tmp_path_) ] slides = slideset.__iter__() for i, slide in enumerate(slides): np.testing.assert_array_almost_equal( slide.resampled_array(), expected_slides[i].resampled_array())