Repository metrics
- Stars
- (277 stars)
- PR merge metrics
- (PR metrics pending)
Description
toqito/state_props/is_separable.py is the least-covered module in the project, at about 88% with roughly 32 uncovered lines. Everything else is at or near 100%, and the repository overall sits just under 99%.
This module matters more than the number suggests: it dispatches across a series of separability criteria, and the uncovered lines are mostly individual criteria branches that never get exercised. A bug in one of those branches would return a wrong separability verdict rather than raising, which is the kind of failure that is easy to miss.
What to do
Find the uncovered lines and add tests that reach them:
uv run pytest --cov-config=.coveragerc --cov=toqito --cov-report=term-missing \
toqito/state_props/tests/test_is_separable.py
Use the Missing column to see which lines are unreached. Note the --cov=toqito part: running coverage against a single submodule triggers a numpy "cannot load module more than once" error, so keep it as written.
Then, for each uncovered branch, construct a state that actually exercises it. Good sources of states with known separability status:
toqito.states(for examplebell,isotropic,werner,horodecki,max_mixed,tile)- states already used elsewhere in
toqito/state_props/tests/
Prefer a few well-chosen states that each light up a specific criterion over many random ones. A test whose name says which criterion it covers is much more useful than a generic one.
Scope
This does not need to be done in one pass. A PR that covers even a handful of branches is welcome, and it is easier to review that way. Say in the PR which criteria you targeted and what the coverage number moved from and to.
Verifying
uv run pytest toqito/state_props/tests/test_is_separable.py -q
uv run ruff check toqito/state_props/tests/test_is_separable.py
Please do not change is_separable.py itself in the same PR. If a new test uncovers an actual bug, that is a valuable find, so open a separate issue or PR for the fix so the two can be reviewed independently.