Skip to content

Test invalid values for reindent_aligned and indent_after_first - #927

Open
gal-a wants to merge 1 commit into
andialbrecht:masterfrom
gal-a:test-option-validation
Open

gal-a wants to merge 1 commit into
andialbrecht:masterfrom
gal-a:test-option-validation

Conversation

@gal-a

@gal-a gal-a commented Oct 7, 2026

Copy link
Copy Markdown
  • ran the tests (pytest) — 506 passed, 2 xfailed, 1 xpassed
  • all style issues addressed (ruff check sqlparse/ passes; no source files touched)
  • your changes are covered by tests — the change is the test
  • not applicable — test-only, no behaviour change

TestFormatReindent.test_option checks that an invalid value raises
SQLParseError for reindent, indent_tabs, indent_width, wrap_after
and comma_first. Two options validated the same way in formatter.py are
missing from it: reindent_aligned and indent_after_first. The latter does
not appear anywhere in the suite.

Both already raise correctly, so this adds no behaviour, only the coverage.
How I noticed: deleting the raise at sqlparse/formatter.py:83 leaves the
entire suite green (505 passed). With these two lines it fails.

I found that by planting small faults in the source and seeing which ones the
suite did not catch.

@gal-a

gal-a commented Oct 7, 2026

Copy link
Copy Markdown
Author

On the tooling, since it is reasonable to ask where the test came from: the
fault-planting is qikly, which I built
recently. It generates test suites from a written specification, scores an
existing suite by planting faults like the one above, and ships an AI Skill
that teaches a coding agent (Claude Code, Codex, Cursor, Gemini CLI) how to
drive it.

The same run turned up a few other survivors in grouping.py and sql.py.
I have not listed them, because the run takes about two minutes and its
output is more useful than my summary of it. Free, offline, no model call,
and nothing leaves your machine:

pip install qikly
qikly --score-code sqlparse --score-tests tests --score-mutants 36 --score-seed 7

Same seed plants the same faults, so you will see exactly what I saw.

Would genuinely value feedback from anyone maintaining a suite this size.

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.

1 participant