Skip to content

Test: Add guard rails for interface refactor#181

Open
kzsigmond wants to merge 5 commits intomainfrom
178-test-basic-tests-for-the-interface
Open

Test: Add guard rails for interface refactor#181
kzsigmond wants to merge 5 commits intomainfrom
178-test-basic-tests-for-the-interface

Conversation

@kzsigmond
Copy link
Contributor

This pull request significantly expands the test coverage for the PYCI interface in tests/test_interface_pyci.py. It introduces new helper classes for testing, adds multiple parameterized tests for core interface behaviors, and includes regression and integration tests to ensure correctness and robustness.

New test infrastructure:

  • Added FakeWavefunction and FakeHamiltonian classes to provide controlled, minimal implementations for unit testing without relying on real quantum chemistry data.
  • Introduced PyCITestSetup class to streamline setup of test cases, including wavefunction, Hamiltonian, and equation objects.

Core interface tests:

  • Added parameterized tests to verify correct handling of nproj, mask shapes, and trimming of spin-unrestricted spaces to spin-restricted spaces in the PYCI interface.
  • Added tests for objective and Jacobian computation, including checks for shape and absence of NaN or infinite values.

Integration and regression tests:

  • Added integration tests using real Hamiltonian and wavefunction data to ensure the interface computes valid results and optimizes correctly.
  • Added regression test for a small system, verifying that computed objectives and Jacobians match expected values and that optimization reduces the cost as intended.

These changes collectively improve the reliability and maintainability of the PYCI interface by providing comprehensive test coverage and robust validation of its key behaviors.

@kzsigmond kzsigmond linked an issue Feb 20, 2026 that may be closed by this pull request
@kzsigmond kzsigmond self-assigned this Feb 26, 2026
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.

Test: basic tests for the interface

1 participant