Skip to content

Test coverage: add tests for ValueError in double_commutator#1264

Open
mhucka wants to merge 2 commits intoquantumlib:mainfrom
mhucka:testing-improvement-double-commutator-18357022893016952040
Open

Test coverage: add tests for ValueError in double_commutator#1264
mhucka wants to merge 2 commits intoquantumlib:mainfrom
mhucka:testing-improvement-double-commutator-18357022893016952040

Conversation

@mhucka
Copy link
Copy Markdown
Contributor

@mhucka mhucka commented Apr 10, 2026

Added test cases to DoubleCommutatorTest in commutators_test.py to cover the cases where the intersection of indices for hopping operators in double_commutator results in an empty set or a set with more than one element, which triggers a ValueError.

mhucka and others added 2 commits April 10, 2026 21:30
Added test cases to DoubleCommutatorTest in commutators_test.py
to cover the cases where the intersection of indices for hopping
operators in double_commutator results in an empty set or a set
with more than one element, which triggers a ValueError.
@mhucka mhucka marked this pull request as ready for review April 10, 2026 21:45
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces two new unit tests for the double_commutator function in src/openfermion/utils/commutators_test.py. These tests cover edge cases for hopping operators where the index intersections are either empty or contain multiple elements, verifying that the function correctly returns zero. I have no feedback to provide.

@mhucka mhucka enabled auto-merge (squash) April 10, 2026 21:55
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.

1 participant