-
generate_custom_diff() creates a custom "word diff", where it looks
for changed words across the entire blocks of "replaced"
lines.Similar to 'git diff --word-diff', removed words are indicated with
[-foo-] and added words are indicated with {+bar+}, but I'm keeping
the lines otherwise in a unified diff form, which keeps the widths
of the output similar to the current diffs and teletekst pages. -
generate_custom_diff_attachment() colorizes the output from
generate_custom_diff(). For testing purposes it will return the PIL
image object if the http object is None. -
Use the new functions in compare_pages -> create_update() & main().
-
tests/test_compare_pages.py introduces some basic unit tests, for
both the original generate_diff() function and the two new
functions.The tests for generate_custom_diff_attachment() are quite minimal,
just confirming that the size is as expected.
====
-
Moved generate_custom_diff() code to a separate Python module, and
turned into a class -
Various changes prompted by pylint
-
generate_custom_diff_attachment() return the character height, for
testing purposes -
Refine the height-check of the resulting images, using the previous
change -
Switched unittest font to DejaVuSansMono, which the actual bot uses
-
Make sure the workflow install that font
-
Separate the two assert()s in TestCustomDiff into two subTest()s
-
Add "test" target in Makefile
-
Add "unittest" step in workflow, that uses the "test" target