-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/jonpecar/qrCodeImageSorter
- Loading branch information
Showing
10 changed files
with
188 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
<<<<<<< Updated upstream | ||
__version__ = "0.6.2" | ||
======= | ||
__version__ = "0.7.3" | ||
>>>>>>> Stashed changes | ||
__version__ = "0.7.2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from distutils.command import build | ||
from typing import List | ||
from fpdf import FPDF | ||
from qrImageIndexer.qr_generator import unpack_data, generate_qr_code_structure | ||
from qrImageIndexer.write_pdf_fpf2 import build_pdf_report | ||
|
||
def generate_qr_pdf(text_data: List[List[str]], qr_for_headings : bool, | ||
repeat_headings : bool, sort_sliceable : bool, string_header : str = '') -> FPDF: | ||
data_struct = unpack_data(text_data, qr_for_headings, string_header) | ||
iamge_struct = generate_qr_code_structure(data_struct) | ||
return build_pdf_report(iamge_struct, repeat_headings, sort_sliceable) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,6 @@ fpdf2 | |
qrcode | ||
tqdm | ||
opencv-python | ||
PyPDF2 | ||
PyPDF2 | ||
pytest | ||
pytest-mock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from qrImageIndexer import generate_qr_wrapper | ||
from unittest import mock | ||
|
||
def mock_qr_generator_functions(mocker : mock): | ||
unpack_data = mocker.patch('qrImageIndexer.generate_qr_wrapper.unpack_data') | ||
generate_qr_structure = mocker.patch('qrImageIndexer.generate_qr_wrapper.generate_qr_code_structure') | ||
build_pdf = mocker.patch('qrImageIndexer.generate_qr_wrapper.build_pdf_report') | ||
|
||
return (unpack_data, generate_qr_structure, build_pdf) | ||
|
||
|
||
def test_single_func_pdf_builder_all_true(mocker): | ||
(unpack_data, generate_qr_structure, build_pdf) = mock_qr_generator_functions(mocker) | ||
result = generate_qr_wrapper.generate_qr_pdf([['Line 1', ''], ['', 'Line 1 Indent']], | ||
True, True, True, r'{header}') | ||
|
||
unpack_data.assert_called_once_with([['Line 1', ''], ['', 'Line 1 Indent']], True, r'{header}') | ||
generate_qr_structure.assert_called_once_with(unpack_data.return_value) | ||
build_pdf.assert_called_once_with(generate_qr_structure.return_value, True, True) | ||
assert result == build_pdf.return_value | ||
|
||
def test_single_func_pdf_builder_no_qr_heading(mocker): | ||
(unpack_data, generate_qr_structure, build_pdf) = mock_qr_generator_functions(mocker) | ||
result = generate_qr_wrapper.generate_qr_pdf([['Line 1', ''], ['', 'Line 1 Indent']], | ||
False, True, True, r'{header}') | ||
|
||
unpack_data.assert_called_once_with([['Line 1', ''], ['', 'Line 1 Indent']], False, r'{header}') | ||
generate_qr_structure.assert_called_once_with(unpack_data.return_value) | ||
build_pdf.assert_called_once_with(generate_qr_structure.return_value, True, True) | ||
assert result == build_pdf.return_value | ||
|
||
def test_single_func_pdf_builder_no_title_all_heading(mocker): | ||
(unpack_data, generate_qr_structure, build_pdf) = mock_qr_generator_functions(mocker) | ||
result = generate_qr_wrapper.generate_qr_pdf([['Line 1', ''], ['', 'Line 1 Indent']], | ||
True, False, True, r'{header}') | ||
|
||
unpack_data.assert_called_once_with([['Line 1', ''], ['', 'Line 1 Indent']], True, r'{header}') | ||
generate_qr_structure.assert_called_once_with(unpack_data.return_value) | ||
build_pdf.assert_called_once_with(generate_qr_structure.return_value, False, True) | ||
assert result == build_pdf.return_value | ||
|
||
def test_single_func_pdf_builder_not_sliceable(mocker): | ||
(unpack_data, generate_qr_structure, build_pdf) = mock_qr_generator_functions(mocker) | ||
result = generate_qr_wrapper.generate_qr_pdf([['Line 1', ''], ['', 'Line 1 Indent']], | ||
True, True, False, r'{header}') | ||
|
||
unpack_data.assert_called_once_with([['Line 1', ''], ['', 'Line 1 Indent']], True, r'{header}') | ||
generate_qr_structure.assert_called_once_with(unpack_data.return_value) | ||
build_pdf.assert_called_once_with(generate_qr_structure.return_value, True, False) | ||
assert result == build_pdf.return_value |