def test_image_open(wsi_file): TiffSlide(wsi_file)
def test_image_open_incorrect_path(): with pytest.raises(FileNotFoundError): TiffSlide("i-do-not-exist")
def test_image_open_unsupported_image(tmp_path): f = tmp_path.joinpath("test_file.svs") f.write_text("123") with pytest.raises(TiffFileError): TiffSlide(f)
def slide(wsi_file): yield TiffSlide(wsi_file)
def test_image_detect_format(wsi_file): fmt = TiffSlide.detect_format(wsi_file) assert fmt is not None assert isinstance(fmt, str)
def test_tiffslide_reject_unsupported_file(): with pytest.raises(ValueError): TiffSlide(dict()) # type: ignore
def test_tiffslide_from_fsspec_urlpath(wsi_file_urlpath): slide = TiffSlide(wsi_file_urlpath) _ = slide.get_thumbnail((200, 200))
def test_tiffslide_from_fsspec_openfile(wsi_file_urlpath): of = fsspec.open(wsi_file_urlpath) slide = TiffSlide(of) _ = slide.get_thumbnail((200, 200))
def test_tiffslide_from_fsspec_buffer(wsi_file_urlpath): with fsspec.open(wsi_file_urlpath) as f: slide = TiffSlide(f) _ = slide.get_thumbnail((200, 200))
def ts_slide(file_name): from tiffslide import TiffSlide yield TiffSlide(file_name)