Testing the Renderer's Backwards Compatibility#7
Open
ilkerkesen wants to merge 1 commit intosign:mainfrom
Open
Testing the Renderer's Backwards Compatibility#7ilkerkesen wants to merge 1 commit intosign:mainfrom
ilkerkesen wants to merge 1 commit intosign:mainfrom
Conversation
AmitMY
requested changes
Oct 23, 2025
| @@ -0,0 +1,128 @@ | |||
| import csv | |||
Contributor
There was a problem hiding this comment.
this file contains lots of repeated code from examples/pixel_renderer/create_sample_images.py
I think you could move all three files under tests/pixel_renderer/regression
then you can import, in the test_ file the relevant functions.
there should also be tests/pixel_renderer/regression/assets with all of the sample images (you should push the images to the repo)
| Taken from the SAMPLE_IMAGES_DIR environment variable. | ||
| If unset, all tests will be skipped. | ||
| """ | ||
| path = os.environ.get("SAMPLE_IMAGES_DIR") |
Contributor
There was a problem hiding this comment.
once the files are in the same dir, you can Path(__file__).parent / "assets" or something, then there's no env variable
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is related to #2, and it should fix the issue also as well. This PR implements backward compatibility tests for the renderer. There are 3 new files,
examples/pixel_renderer/samples.tsvcontains example sentences from SIB-200. This file includes 5 examples per language, covering all 200 langauges present in the SIB-200 benchmark.examples/pixel_renderer/create_sample_images.py: This script reads thesamples.tsv(via--input-fileoption) and produces sample rendered text images per language at the specified--output-dir, using the provided set of example sentences. So, instead of saving all images individually, this script groups examples by language, concatenates visually rendered sentences vertically, and produces one image file per language (e.g.eng_Latn.png). It copies thesamples.tsvfile into this directory, and additionally creates a JSON fileversions.jsonwhich contains the current versions of related packages (e.g.pango,pygobject).tests/pixel_renderer/test_backward_compatibility.py: This is the main test file. It takes the sample image directory path via the environment variableSAMPLE_IMAGES_DIR. I don't know whether there exists a more viable solution to pass command line arguments usingpytest.ruff checkdoes not create any warning/error for these new files. I used AI tools to implement tests where I reviewed the code accordingly in detail. I was not completely sure about where I should have putsamples.tsvandcreate_sample_images.pyfiles. We can also move these files to somewhere else. Also, if there is better way to pass the sample image dir value other than environment variable, let's follow that approach. Lastly, this PR is not ready for merge, because I need to write some documentation about it.