Conversation
piotr-3-janiszewski
left a comment
There was a problem hiding this comment.
I think your tests are great! The code isn't hard to read, both the structure and naming makes sense. I personally (might be totally wrong, but I) think that there are many places in your code where adding a fixture might enable you to cover more edge cases without much effort. Great job 🥇 🎆 💯 👍 🏆
| ) | ||
|
|
||
| @pytest.fixture | ||
| def mock_page_sizes(): |
There was a problem hiding this comment.
Maybe we could add more edge cases? For example a square page? Or a very long page?
| from pypdf import PdfReader, PdfWriter, PageObject | ||
|
|
||
| from printing.processing.pages import PageSize, PageSizes, PageOrientation | ||
|
|
There was a problem hiding this comment.
The following two tests could be merged into one with a fixture and could cover more edge cases. Like being a square.
There was a problem hiding this comment.
I agree, it's worth testing the page size utility functions on different sizes, especially covering the cases:
width/height < 1/2width/height = 1/2width/height > 1/2, < 1width/height = 1width/height > 1, < 2width/height = 2width/height > 2
The first and last case are especially confusing and thus error-prone, because splitting such pages along either edge does not change the page orientation. Make sure to test the page splitting utilities as well.
There was a problem hiding this comment.
.coverage files should be ignored, this has been done in #154
| from pypdf import PdfReader, PdfWriter, PageObject | ||
|
|
||
| from printing.processing.pages import PageSize, PageSizes, PageOrientation | ||
|
|
There was a problem hiding this comment.
I agree, it's worth testing the page size utility functions on different sizes, especially covering the cases:
width/height < 1/2width/height = 1/2width/height > 1/2, < 1width/height = 1width/height > 1, < 2width/height = 2width/height > 2
The first and last case are especially confusing and thus error-prone, because splitting such pages along either edge does not change the page orientation. Make sure to test the page splitting utilities as well.
cd backend
pytest printing/tests/printing/processing/test_pages.py --cov
pytest printing/tests/printing/processing/test_imposition.py --cov
pytest printing/tests/printing/processing/test_final_pages.py --cov
pytest printing/tests/printing/processing/test_converter.py --cov