Merge in RR/image-prediction from RED-5107-robustify-image-service-alternative to release/1.2.x
Squashed commit of the following:
commit 1a8fbeebd3c05f25d69210e53bf6dce67bc2342f
Merge: 00ac0d6 c03913e
Author: Matthias Bisping <matthias.bisping@axbit.com>
Date: Tue Aug 30 16:19:16 2022 +0200
Merge branch 'release/1.2.x' into RED-5107-robustify-image-service-alternative
commit 00ac0d61abdd97eb7c2576d2db9e6859b91c9c41
Author: Matthias Bisping <matthias.bisping@axbit.com>
Date: Tue Aug 30 16:03:41 2022 +0200
applied black
commit 983265f4355253a3a371747b04b1926ff3578fef
Author: Matthias Bisping <matthias.bisping@axbit.com>
Date: Tue Aug 30 15:59:11 2022 +0200
Added image validation after image extraction to parsable-pdf image extractor. Invalid images are dropped, hence these images will appear as skipped for the service caller.
33 lines
740 B
Python
33 lines
740 B
Python
import pytest
|
|
from funcy import rcompose, chunks
|
|
|
|
|
|
def test_rcompose():
|
|
f = rcompose(lambda x: x**2, str, lambda x: x * 2)
|
|
assert f(3) == "99"
|
|
|
|
|
|
def test_chunk_iterable_exact_split():
|
|
a, b = chunks(5, iter(range(10)))
|
|
assert a == list(range(5))
|
|
assert b == list(range(5, 10))
|
|
|
|
|
|
def test_chunk_iterable_no_split():
|
|
a = next(chunks(10, iter(range(10))))
|
|
assert a == list(range(10))
|
|
|
|
|
|
def test_chunk_iterable_last_partial():
|
|
a, b, c, d = chunks(3, iter(range(10)))
|
|
assert d == [9]
|
|
|
|
|
|
def test_chunk_iterable_empty():
|
|
with pytest.raises(StopIteration):
|
|
next(chunks(3, iter(range(0))))
|
|
|
|
|
|
def test_chunk_iterable_less_than_chunk_size_elements():
|
|
assert next(chunks(5, iter(range(2)))) == [0, 1]
|