def test_slice_plate_image(self, image_circle): plates = PlateCollection(shape=(1, 1)) plates.add(id=1, diameter=180, edge_cut=20, center=(102, 102)) images = plates.slice_plate_image(image_circle) assert len(images) == 1 assert images[1].shape == (141, 141)
def test_centers(self): centers = list() collection = PlateCollection() for i in range(1, 10): center = (i, i) centers.append(center) collection.add(id=i, diameter=1, center=center) assert collection.count == len(centers) assert collection.centers == centers
def test_plates_from_image(self, image_circle): label = "label" plates = PlateCollection(shape=(1, 1)) plates.plates_from_image(image=image_circle, diameter=180, labels={1: label}) assert plates.count == 1 assert plates.centers == [(102, 102)] assert plates.items[0].diameter == 160 assert plates.items[0].name == label
def test_plates_from_image_invalid(self, image_circle): plates = PlateCollection() with pytest.raises(ValueError): plates.plates_from_image(image=image_circle, diameter=180)
def test_add(self, id, diameter): collection = PlateCollection() item_new = collection.add(id=id, diameter=diameter) assert collection.count == 1 assert item_new in collection.items
def test_init_invalid(self, shape): with pytest.raises(ValueError): PlateCollection(shape=shape)
def test_init(self, shape): collection = PlateCollection(shape=shape) assert collection.shape == shape