Skip to content

Add tests for ValueError in double_commutator#1264

Merged
mhucka merged 3 commits intoquantumlib:mainfrom
mhucka:testing-improvement-double-commutator-18357022893016952040
Apr 23, 2026
Merged

Add tests for ValueError in double_commutator#1264
mhucka merged 3 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
@mhucka mhucka changed the title Test coverage: add tests for ValueError in double_commutator Add tests for ValueError in double_commutator Apr 19, 2026
@mhucka
Copy link
Copy Markdown
Contributor Author

mhucka commented Apr 19, 2026

/gemini review

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 adds two unit tests to src/openfermion/utils/commutators_test.py to verify the double_commutator function's behavior with hopping operators. Specifically, it tests cases where the index intersections are empty or contain multiple elements, ensuring the result is zero. I have no feedback to provide.

@mhucka mhucka added this pull request to the merge queue Apr 22, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 22, 2026
@mhucka mhucka added this pull request to the merge queue Apr 22, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 23, 2026
@mhucka mhucka added this pull request to the merge queue Apr 23, 2026
Merged via the queue into quantumlib:main with commit 1728ca1 Apr 23, 2026
18 checks passed
@mhucka mhucka deleted the testing-improvement-double-commutator-18357022893016952040 branch April 23, 2026 21:14
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