Repository navigation
Add templates 6 - #1158
Merged
Merged
Add templates 6#1158
Conversation
Contributor
|
This PR touches files which potentially affect the outcome of the tests of an exercise. This will cause all students' solutions to affected exercises to be re-tested. If this PR does not affect the result of the test (or, for example, adds an edge case that is not worth rerunning all tests for), please add the following to the merge-commit message which will stops student's tests from re-running. Please copy-paste to avoid typos. For more information, refer to the documentation. If you are unsure whether to add the message or not, please ping |
depial
approved these changes
Oct 24, 2026
82 tasks done
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.
Another 8 templates, plus some template macros.
I finally thought to ask for the comments to be written to a Markdown file with proper formatting. Better late than never?
Adds Jinja2 test templates for word-count, nucleotide-count, etl, resistor-color-trio, kindergarten-garden, food-chain, proverb and yacht
Each
runtests.jlis regenerated from canonical data, and every exercise passes against its example solution. In line with the canonical-only decision, the hand-written tests that weren't in the canonical data have been removed.Things to look at:
config/generator_macros.j2):julia_stringnow also escapes newlines and tabs as\nand\t. word-count and kindergarten-garden need this.julia_dict(d, char_keys=false)macro. It writes aDict(...)literal, quoting string keys, or writing them asCharliterals ('A') whenchar_keys=true. Values reusejulia_stringandjulia_vector.--check, so their generated files don't change.Charkeys: nucleotide-count and etl useCharkeys and letters where the canonical data has strings, so their templates usechar_keys=true. etl also turns the canonical string score keys into integers:transform(Dict(1 => ['A'])) == Dict('a' => 1).{value, unit}becomes the string the Julialabelreturns, e.g."2 kiloohms".recitereturns a single string, so the canonical list of lines is joined with\n.DomainError."3.3 kiloohms". The canonical data only has whole numbers, so decimal formatting is no longer tested. Worth a look, because the example solution handles decimals.wordcount(" .\n,\t!^&*()~@#\$%{}[]:;'/<>") == Dict(), and the"Should've could've would've"check.