Exemplo n.º 1
0
def test_register_image_importer(is_file):
    from menpo.image import Image
    image = Image.init_blank((10, 10))

    def foo_importer(filepath, **kwargs):
        return image

    is_file.return_value = True

    with patch.dict(mio.input.extensions.image_types, {}, clear=True):
        mio.register_image_importer('.foo', foo_importer)
        new_image = mio.import_image('fake.foo')
    assert image is new_image
Exemplo n.º 2
0
def test_register_image_importer(is_file):
    from menpo.image import Image
    image = Image.init_blank((10, 10))

    def foo_importer(filepath, **kwargs):
        return image

    is_file.return_value = True

    with patch.dict(mio.input.extensions.image_types, {}, clear=True):
        mio.register_image_importer('.foo', foo_importer)
        new_image = mio.import_image('fake.foo')
    assert image is new_image