Skip to content

Commit

Permalink
Merge pull request #41 from sbrunner/test
Browse files Browse the repository at this point in the history
Test
  • Loading branch information
sbrunner committed Jan 18, 2020
2 parents 6bc52a6 + e70847c commit 7e025d6
Show file tree
Hide file tree
Showing 10 changed files with 489 additions and 360 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ jobs:
- run:
name: Extract data from Docker volumes
command: |
mkdir -p results/prof/
docker cp volumes:/results/ results/
docker cp volumes:/tests/prof/ results/prof/
docker cp volumes:/results/ ./
mkdir -p results/
docker cp volumes:/tests/prof/ results/
when: always
- store_artifacts:
path: results
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/results/
/dist/
__pycache__
/scan_to_paperless.egg-info/
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
extension-pkg-whitelist=cv2

[MESSAGES CONTROL]
disable=R0912,R0915,R1702,W0703,R0914,C0111,E1121,E1120
disable=R0912,R0915,R1702,W0703,R0914,C0111,E1121,E1120,locally-disabled,too-many-lines,bad-continuation

[FORMAT]
max-line-length=110
Expand Down
783 changes: 428 additions & 355 deletions process

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion scan_to_paperless/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
import subprocess
import sys
import time
import numpy as np

import argcomplete
import numpy as np
import yaml
from argcomplete.completers import ChoicesCompleter
from skimage import io
Expand Down
Binary file added tests/assisted-split-booth-1.expected.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/assisted-split-booth-2.expected.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/assisted-split-booth-3.expected.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/assisted-split-booth-4.expected.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 55 additions & 0 deletions tests/test_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,61 @@ def test_assisted_split_join_full():
check_image_file(root_folder, os.path.join(root_folder, 'final.png'), 'assisted-split-join-2')


# @pytest.mark.skip(reason='for test')
def test_assisted_split_booth():
init_test()
# os.environ['PROGRESS'] = 'TRUE'
root_folder = '/results/assisted-split-booth'
if not os.path.exists(root_folder):
os.makedirs(root_folder)

shutil.copyfile(
os.path.join(os.path.dirname(__file__), 'image-1.png'),
os.path.join(root_folder, 'image-1.png'),
)

config = {
'args': {
'assisted_split': True,
'level': False,
'append_credit_card': False,
'nocrop': True,
'tesseract': False,
'margin_horizontal': 0,
'margin_vertical': 0,
},
'full_name': 'Test title 2',
'destination': os.path.join(root_folder, 'final.pdf'),
'assisted_split': [
{
'image': os.path.join(root_folder, 'image-1.png'),
'source': os.path.join(os.path.dirname(__file__), 'image-1.png'),
'limits': [{
'value': 150,
'vertical': True,
'margin': 0
}, {
'value': 150,
'vertical': False,
'margin': 0
}],
'destinations': ['1', '2', '3', '4']
},
],
}
step = {
'name': 'split',
'sources': ['image-1.png'],
}
step = process.split(config, step, root_folder)
assert step['name'] == 'finalise'
assert len(step['sources']) == 4
check_image_file(root_folder, step['sources'][0], 'assisted-split-booth-1')
check_image_file(root_folder, step['sources'][1], 'assisted-split-booth-2')
check_image_file(root_folder, step['sources'][2], 'assisted-split-booth-3')
check_image_file(root_folder, step['sources'][3], 'assisted-split-booth-4')


# @pytest.mark.skip(reason='for test')
@pytest.mark.parametrize('progress', ['FALSE', 'TRUE'])
@pytest.mark.parametrize('experimental', ['FALSE', 'TRUE'])
Expand Down

0 comments on commit 7e025d6

Please sign in to comment.