コード例 #1
0
def test_image_count():
    ic = ImageComposition(dummy())
    img1 = ComposableImage(Image.new("RGB", (1, 1)))
    img2 = ComposableImage(Image.new("RGB", (1, 1)))
    img3 = ComposableImage(Image.new("RGB", (1, 1)))
    ic.add_image(img1)
    ic.add_image(img2)
    ic.add_image(img3)
    assert len(ic.composed_images) == 3
    ic.remove_image(img3)
    assert len(ic.composed_images) == 2
    ic.remove_image(img2)
    assert len(ic.composed_images) == 1
    ic.remove_image(img1)
    assert len(ic.composed_images) == 0
コード例 #2
0
def test_image_remove_image_none():
    ic = ImageComposition(dummy())
    with pytest.raises(AssertionError):
        ic.remove_image(None)