Skip to content

test: 36 assigned-but-unused locals in the test suite may be dropped assertions #265

Description

@domattioli

Finding

Ruff reports 36 F841 (local variable assigned but never used) findings, most of them in tests/. Examples:

  • tests/test_spatial_indexing.py:184elem_id
  • tests/test_unification_api_contract.py:249required_layer_keys

In library code the equivalent findings are usually benign (a parse that exists to raise ValueError), but in a test file an unused local is a different signal: it often means a value was computed for an assertion that was never written, or that an assertion was removed while the setup was left behind. required_layer_keys in an API-contract test is exactly that shape — a set of expected keys that nothing compares against.

Why this is not a mechanical fix

Deleting these lines would silence the warning and simultaneously erase the evidence that a check is missing. Each site needs a human to decide whether the correct fix is to delete the local or to add the assertion it was clearly meant to feed.

Suggested approach

Walk the 36 sites (ruff check tests --select=F841) and for each: add the missing assertion, or delete the dead setup with a one-line justification in the commit message. Prioritize the API-contract and invariant tests, where a silently absent assertion costs the most.

[model: claude-opus, repo: CHILmesh, session: dev-cleanup sweep]

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions