Skip to content

test: parametrize Horodecki state dimensions#1897

Open
Jethin10 wants to merge 1 commit into
vprusso:masterfrom
Jethin10:agent/parametrize-horodecki-tests
Open

test: parametrize Horodecki state dimensions#1897
Jethin10 wants to merge 1 commit into
vprusso:masterfrom
Jethin10:agent/parametrize-horodecki-tests

Conversation

@Jethin10

Copy link
Copy Markdown

Summary

  • consolidate the default, 3-by-3, and 2-by-4 Horodecki state checks into one parametrized test
  • use full-precision expected matrices instead of rounded fixtures
  • tighten the 2-by-4 tolerance from 0.2 to 1e-12 so incorrect matrix entries cannot pass unnoticed

Validation

  • uv run pytest toqito/states/tests/test_horodecki.py -q (6 passed)
  • uv run ruff check toqito/states/tests/test_horodecki.py
  • uv run ruff format --check toqito/states/tests/test_horodecki.py
  • uv run ty check toqito/states/tests/test_horodecki.py
  • full pytest was attempted locally but exceeded 15 minutes without surfacing a failure; CI will run the authoritative full suite
  • repository-wide ty check toqito currently reports existing diagnostics outside this changed test file

Addresses #1896.

@codecov

codecov Bot commented Jul 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Jethin10
Jethin10 marked this pull request as ready for review July 25, 2026 19:55
Copilot AI review requested due to automatic review settings July 25, 2026 19:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Horodecki state tests by consolidating multiple dimension-specific checks into a single parametrized test, using full-precision expected matrices and tightening numeric tolerances to better detect incorrect outputs.

Changes:

  • Replaces separate 3×3 (default + explicit) and 2×4 tests with one @pytest.mark.parametrize test over supported dimensions.
  • Introduces full-precision expected density matrices as module-level constants.
  • Tightens assert_allclose tolerance (including for the 2×4 case) to atol=1e-12 with rtol=0.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +44 to +47
def test_horodecki_state_dimensions(dim, expected_res):
"""The Horodecki state for each supported dimension."""
res = horodecki(0.5, dim)
np.testing.assert_allclose(res, expected_res, rtol=0, atol=1e-12)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants