Skip to content
Snippets Groups Projects
Commit aeeaa127 authored by Hugo Kerstens's avatar Hugo Kerstens
Browse files

Add test for image extraction

parent a90a2d25
No related branches found
No related tags found
1 merge request!137Use Wand as a fallback for image extraction
Pipeline #17407 passed
File added
...@@ -265,3 +265,18 @@ def test_all_effects( ...@@ -265,3 +265,18 @@ def test_all_effects(
# image.show() # image.show()
success, reason = scans.process_page(image, new_exam, datadir) success, reason = scans.process_page(image, new_exam, datadir)
assert success is expected, reason assert success is expected, reason
@pytest.mark.parametrize('filename', [
'blank-a4-2pages.pdf',
'flattened-a4-2pages.pdf'],
ids=['blank pdf', 'flattened pdf'])
def test_image_extraction(datadir, filename):
file = os.path.join(datadir, filename)
page = 0
for img, pagenr in scans.extract_images(file):
page += 1
assert pagenr == page
assert img is not None
assert np.average(np.array(img)) == 255
assert page == 2
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment