Skip to content

test: cover toCamelCase first_upper=True branch - #765

Open
olitreadwell wants to merge 1 commit into
Amsterdam:masterfrom
olitreadwell:olitreadwell/cover-tocamelcase-first-upper
Open

test: cover toCamelCase first_upper=True branch#765
olitreadwell wants to merge 1 commit into
Amsterdam:masterfrom
olitreadwell:olitreadwell/cover-tocamelcase-first-upper

Conversation

@olitreadwell

Copy link
Copy Markdown

What changed

Add a unit test for toCamelCase(..., first_upper=True) (the PascalCase form).

Test only. No source change.

Why

toCamelCase has a first_upper argument, but no test exercised the first_upper=True branch.

A coverage run on naming.py reported exactly one missing line, line 82, which is that branch:

src/schematools/naming.py   25   1   6   1   94%   82

That branch is not dead code: schematools/types.py calls toCamelCase(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

uv sync --extra django
uv run pytest tests/test_naming.py \
  --cov=schematools.naming --cov-report=term-missing -q

Coverage

Before: naming.py 94% (line 82 missing) / After: naming.py 100%.

Checks run locally

  • Tests: PASS (4 passed, 0 failed — tests/test_naming.py, re-verified during this audit with uv run pytest)
  • Lint: PASS (uvx pre-commit run --files tests/test_naming.py: ruff, pyupgrade, django-upgrade, whitespace/EOF all pass, re-verified during this audit)
  • Typecheck: N/A — this repo has no mypy/typecheck hook in CI or pre-commit
  • Build: N/A — test-only change, no packaging impact

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant