Closed bethac07 closed 2 years ago
Some tests in core
now failing, digging in
======================================================================================================= FAILURES =======================================================================================================
__________________________________________________________________________________________________ test_load_objects ___________________________________________________________________________________________________
def test_load_objects():
path = tests.modules.maybe_download_example_image(
["ExampleSBSImages"], "Channel2-01-A-01.tif"
)
target = bioformats.load_image(path, rescale=False)
target = skimage.morphology.label(target)
with open(path, "rb") as fd:
md5 = hashlib.md5(fd.read()).hexdigest()
workspace = run_workspace(
path, cellprofiler_core.modules.namesandtypes.LOAD_AS_OBJECTS
)
o = workspace.object_set.get_objects(OBJECTS_NAME)
assert isinstance(o, cellprofiler_core.object.Objects)
areas = o.areas
counts = numpy.bincount(target.flatten())
assert areas[0] == counts[1]
assert areas[1] == counts[2]
> assert areas[2] == counts[3]
E assert 1 == 2
tests/modules/test_namesandtypes.py:1928: AssertionError
_______________________________________________________________________________________________ test_load_single_object ________________________________________________________________________________________________
def test_load_single_object():
path = tests.modules.maybe_download_example_image(
["ExampleSBSImages"], "Channel1-01-A-01.tif"
)
lsi_path = tests.modules.maybe_download_example_image(
["ExampleSBSImages"], "Channel2-01-A-01.tif"
)
target = bioformats.load_image(lsi_path, rescale=False)
target = skimage.morphology.label(target)
with open(lsi_path, "rb") as fd:
md5 = hashlib.md5(fd.read()).hexdigest()
workspace = run_workspace(
path,
cellprofiler_core.modules.namesandtypes.LOAD_AS_GRAYSCALE_IMAGE,
lsi=[
{
"path": lsi_path,
"load_as_type": cellprofiler_core.modules.namesandtypes.LOAD_AS_OBJECTS,
"name": "lsi",
}
],
)
o = workspace.object_set.get_objects("lsi")
assert isinstance(o, cellprofiler_core.object.Objects)
counts = numpy.bincount(target.flatten())
areas = o.areas
assert areas[0] == counts[1]
assert areas[1] == counts[2]
> assert areas[2] == counts[3]
E assert 1 == 2
tests/modules/test_namesandtypes.py:2064: AssertionError
They... stopped failing and I don't know why?
All tests now passing in core and CellProfiler
Resolves #153
All tests passing locally, and can still open bioformats-requiring files in local cellprofiler.