back-end for test case generator#547
Open
FitashUlHaq wants to merge 2 commits into
Open
Conversation
Easy-finding cleanups from the deep review of PR #547. Design-call items (hypothesis dep gating, class rename to avoid pytest collision, template logic bugs around assoc.multiplicity/target_class, OCL/quote injection hardening, missing tests, missing docs) are left for @FitashUlHaq to address. * Delete hypothesis_tests_template.py_old.j2 (452-line dead template). * test_generator.py: - Add module docstring. - Move duplicated 'import re' and 'from jinja2 import ...' from inside generate() to module top. - Promote regex_findall / regex_replace to module-level helpers (they are referenced by the OCL section of the template, line 235+, so keep them registered as Jinja filters; pre-existing nested defs only worked by accident). - Drop the unused *args from generate(); add -> None return type. - Remove the print() debug left in. - Normalize quote style and dict alignment per ruff/black defaults. * __init__.py: explicit 'X as X' re-export to silence ruff F401. * backend/config/generators.py: - Dedent the 'test_case' GeneratorInfo kwargs from 8 spaces to 4 to match every sibling entry. - Move the 'test_case' branch of get_filename_for_generator into the python/pydantic/... dispatch chain rather than hanging off the 'if not info:' early-return guard. Verified: ruff check passes; generator produces a non-empty test_hypothesis.py for a minimal DomainModel.
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 commit contains the back-end for test case generator