test: cover toCamelCase first_upper=True branch - #3
Closed
olitreadwell wants to merge 1 commit into
Closed
Conversation
Add test_toCamelCase_first_upper for the PascalCase form of toCamelCase. This first_upper=True path had no direct test; it is the single line that coverage reported missing in naming.py (line 82). It is the form used in schematools.types to build class names from dataset and table ids, so it is worth locking down. Values were verified against the current implementation. Also checks that an empty ident still raises ValueError with first_upper=True.
olitreadwell
force-pushed
the
olitreadwell/cover-tocamelcase-first-upper
branch
from
August 18, 2026 22:33
6a5f4aa to
065d059
Compare
Owner
Author
|
Closing as superseded: the same change is already open upstream in Amsterdam#765. See Amsterdam#765 |
Owner
Author
|
Superseded by upstream Amsterdam#765. |
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.
Upstream target
Amsterdam/schema-tools: no issue, self-found test-coverage gap.
What changed
Add a unit test for
toCamelCase(..., first_upper=True)(the PascalCase form).Test only.
No source change.
Why
toCamelCasehas afirst_upperargument, but no test exercised thefirst_upper=Truebranch.A coverage run on
naming.pyreported exactly one missing line: line 82, which is that branch:That branch is not dead code:
schematools/types.pycallstoCamelCase(self.id, first_upper=True)(lines 443 and 1305) to build class names from dataset and table ids.So the behaviour is worth locking down.
How to verify
Before this change:
naming.py94%, line 82 missing.After this change:
naming.py100%, no missing lines. 4 passed.Coverage
Before: naming.py 94% (line 82 missing) / After: naming.py 100%.
Checks run locally
uv run pytest)uvx pre-commit run --files tests/test_naming.py: ruff, pyupgrade, django-upgrade, whitespace/EOF all pass, re-verified during this audit)The full pytest suite needs PostgreSQL + GDAL, which the fork CI provides (postgis service container + gdal apt install).
This change only touches the pure
tests/test_naming.py, which needs neither.Style / template compliance
No CONTRIBUTING.md, no PR template, and no CLA/DCO requirement found in this repo.
Matched the existing style of
tests/test_naming.py: same imports, same-> Nonesignatures, docstring first line, grounded assertions, and apytest.raises(ValueError)empty-string check like the neighbouring tests.Commit convention: this repo's own history is plain, lowercase, imperative, no type prefix, no emoji (e.g.
add tests,improve test coverage,catch unexpected validation errors).The original commit here used a Conventional Commits style (
test: ✅ ...) which doesn't match.During this audit I amended the single commit to
add test for toCamelCase first_upper branchto match the house style, and force-pushed the fix, the PR content is unchanged.AI review (ocr)
Ran
ocr delegate rule(delegation mode, self-reviewed against its Python rubric: no mutable defaults, no dead code, no resource/exception-handling issues, correct==comparisons throughout).All seven assertions were re-verified during this audit by actually running the new test (
uv run pytest), not just re-reading them: confirmed passing against the real implementation, not guessed values.Clean, no changes needed.
Confidence: HIGH
Small, isolated, additive test.
Expected values were produced by the current implementation, not guessed.
Worst case: a future refactor of
toCamelCasechanges the PascalCase output, which is exactly what this test is meant to catch.Promotion command (when Oli chooses to send this upstream):
No CLA, no DCO, no signed-commit requirement, no PR template file to fill.
AI assistance
Drafted with AI assistance.
The gap was found and verified against the current code, the change was verified before opening, and this diff was reviewed line by line.
PROMOTION NOTE (remove this section before/when opening against upstream):
Prerequisites: none outstanding (re-verify CLA/DCO/signing before promoting).