Skip to content

Rework the pad_inches test and reorganize the express API test files - #106

Merged
john-boyer-phd merged 4 commits into
graph-algorithms:masterfrom
YuEfSaEDU:tests/express-api-cleanup-104
Sep 22, 2026
Merged

john-boyer-phd merged 4 commits into
graph-algorithms:masterfrom
YuEfSaEDU:tests/express-api-cleanup-104

Conversation

@YuEfSaEDU

Copy link
Copy Markdown
Contributor

Reworks the pad_inches test and splits the express API tests into per-endpoint files. Fixes #104.

The pad test is back as a pixel test on the K5-minus-edge image at figsize=(4,3): from the midpoint of each image edge it walks in and expects pad_inches * dpi background pixels before the drawing, for pad values 0.0, 0.1 and 0.5. On the right it starts a quarter of the way down, because the rightmost ink there is a vertical edge line that ends above the bottom vertices. With bordered vertices the run measures a pixel short, so the check allows two pixels of slack.

Measured on current master: 0/10/50 background pixels at 0.0/0.1/0.5 on all four sides, with the image exactly 400x300 at every pad.

Renames: test_draw_colors.py → test_express_api_draw.py (also takes in test_draw_text, since ascii() is on the way out per #94), test_planarity.py → test_express_api_is_planar.py, test_planarity_networkx.py → test_express_api_networkx.py. The write() and kuratowski_edges() tests moved out to their own files.

Suite is 50 tests now, up from 48 — the pad test runs through both draw() entry points. One stale comment in test_png_background_and_transparency (it still says the saved image comes out smaller than the figsize) predates the figsize fix; I left it alone.

YuEfSaEDU and others added 4 commits September 22, 2026 02:38
Re-enable test_draw_pad_inches_controls_output_padding as a pixel test
on the K5-minus-edge image with figsize=(4,3), and split the express API
tests into per-endpoint files. Fixes graph-algorithms#104

@john-boyer-phd john-boyer-phd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks all good, YUSUF. Thanks for helping to get the code all organized, and for the excellent test of pad_inches. It looks like something I did in draw() makes Python 3.10 a little unhappy, and your test is catching that. However, we need to change out 3.10 for 3.15 in the October timeframe anyway, so it's best to sunset 3.10 now so all tests will pass on all Pythons that will be supported by 1.1.0.

@john-boyer-phd
john-boyer-phd merged commit 0f4cf92 into graph-algorithms:master Sep 22, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Express API: Clean up of test routines

2 participants