Skip to content

Add unit tests for TFQPauliSumCollector.collect#1015

Open
mhucka wants to merge 3 commits intotensorflow:masterfrom
mhucka:testing-improvement-batch-util-collect-14735591548278787759
Open

Add unit tests for TFQPauliSumCollector.collect#1015
mhucka wants to merge 3 commits intotensorflow:masterfrom
mhucka:testing-improvement-batch-util-collect-14735591548278787759

Conversation

@mhucka
Copy link
Member

@mhucka mhucka commented Mar 13, 2026

This change implements unit tests for the collect method in TFQPauliSumCollector, addressing a testing gap in batch_util_test.py. The new tests cover:

  • Standard Pauli Z observable (expected energy -1.0)
  • Identity observable (expected energy 1.0)
  • Mixed observable (Z + 2.0*I) (expected energy 1.0)

This change implements unit tests for the `collect` method in `TFQPauliSumCollector`,
addressing a testing gap in `batch_util_test.py`. The new tests cover:
- Standard Pauli Z observable (expected energy -1.0)
- Identity observable (expected energy 1.0)
- Mixed observable (Z + 2.0*I) (expected energy 1.0)

This improves the reliability and coverage of the batch utility module.
Copy link

@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 unit tests for the collect method of TFQPauliSumCollector, which is a good addition to improve test coverage. The tests cover several important cases, including Z, Identity, and mixed observables. My feedback includes a suggestion to refactor the test to improve its structure and maintainability, making it more concise and easier to extend in the future.

@tensorflow tensorflow deleted a comment from gemini-code-assist bot Mar 13, 2026
mhucka and others added 2 commits March 13, 2026 09:55
Good suggestion from Gemini Code Assist.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@mhucka mhucka marked this pull request as ready for review March 16, 2026 18:05
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