diff --git a/.github/workflows/ci-daily.yml b/.github/workflows/ci-daily.yml index d1f7606a5ed..4748c3d90c2 100644 --- a/.github/workflows/ci-daily.yml +++ b/.github/workflows/ci-daily.yml @@ -71,7 +71,8 @@ jobs: strategy: matrix: python-version: ['3.10', '3.11'] - runs-on: macos-latest + # TODO(#6577): upgrade to macos-latest when it runs Python 3.10 + runs-on: macos-13 steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 13c7e397487..02a29248316 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -260,7 +260,8 @@ jobs: strategy: matrix: python-version: [ '3.10', '3.11' ] - runs-on: macos-latest + # TODO(#6577): upgrade to macos-latest when it runs Python 3.10 + runs-on: macos-13 steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 diff --git a/cirq-core/cirq/study/sweeps.py b/cirq-core/cirq/study/sweeps.py index f075de48058..3f98798f602 100644 --- a/cirq-core/cirq/study/sweeps.py +++ b/cirq-core/cirq/study/sweeps.py @@ -236,8 +236,6 @@ def keys(self) -> List['cirq.TParamKey']: return sum((factor.keys for factor in self.factors), []) def __len__(self) -> int: - if not self.factors: - return 0 length = 1 for factor in self.factors: length *= len(factor) diff --git a/cirq-core/cirq/study/sweeps_test.py b/cirq-core/cirq/study/sweeps_test.py index aba82eacd23..83d0e0cc201 100644 --- a/cirq-core/cirq/study/sweeps_test.py +++ b/cirq-core/cirq/study/sweeps_test.py @@ -142,6 +142,11 @@ def test_product(): assert _values(sweep, 'b') == [4, 5, 6, 7, 4, 5, 6, 7, 4, 5, 6, 7] +def test_empty_product(): + sweep = cirq.Product() + assert len(sweep) == len(list(sweep)) == 1 + + def test_slice_access_error(): sweep = cirq.Points('a', [1, 2, 3]) with pytest.raises(TypeError, match=''):