quantumlib / Cirq

A Python framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits.
Apache License 2.0
4.28k stars 1.02k forks source link

Fix `__len__` of empty Product sweep to match actual length #6575

Closed maffoo closed 6 months ago

maffoo commented 6 months ago

An empty cirq.Product() sweep yields one empty param resolver, but was reporting a length of 0 when calling __len__. This fixes the __len__ computation so it agrees with the actual length of the sweep when iterating.

codecov[bot] commented 6 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 97.79%. Comparing base (e1b03ef) to head (fb4a64a). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #6575 +/- ## ======================================= Coverage 97.79% 97.79% ======================================= Files 1124 1124 Lines 95684 95685 +1 ======================================= + Hits 93574 93576 +2 + Misses 2110 2109 -1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.