test: cover toCamelCase first_upper=True branch - #765
Open
olitreadwell wants to merge 1 commit into
Open
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.
4 tasks
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.
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
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.