Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
@pytest.mark.parametrize(
'circuit_dag,sorted_nodes',
[
(dag, cca.random_topological_sort(dag))
(dag, tuple(cca.random_topological_sort(dag)))
for dag in [
cirq.CircuitDag.from_circuit(cirq.testing.random_circuit(10, 10, 0.5)) for _ in range(5)
]
Expand Down
14 changes: 8 additions & 6 deletions cirq-core/cirq/study/sweeps_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,18 @@ def test_access_sweep():
assert sixth_elem == cirq.ParamResolver({'a': 2, 'b': 5})


# We use factories since some of these produce generators and we want to
# test for passing in a generator to initializer.
@pytest.mark.parametrize(
'r_list',
'r_list_factory',
[
[{'a': a, 'b': a + 1} for a in (0, 0.5, 1, -10)],
({'a': a, 'b': a + 1} for a in (0, 0.5, 1, -10)),
({sympy.Symbol('a'): a, 'b': a + 1} for a in (0, 0.5, 1, -10)),
lambda: [{'a': a, 'b': a + 1} for a in (0, 0.5, 1, -10)],
lambda: ({'a': a, 'b': a + 1} for a in (0, 0.5, 1, -10)),
lambda: ({sympy.Symbol('a'): a, 'b': a + 1} for a in (0, 0.5, 1, -10)),
],
)
def test_list_sweep(r_list):
sweep = cirq.ListSweep(r_list)
def test_list_sweep(r_list_factory):
sweep = cirq.ListSweep(r_list_factory())
assert sweep.keys == ['a', 'b']
assert len(sweep) == 4
assert len(list(sweep)) == 4
Expand Down
5 changes: 3 additions & 2 deletions cirq-core/cirq/testing/circuit_compare_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,10 @@ def test_random_same_matrix(circuit):

cirq.testing.assert_circuits_with_terminal_measurements_are_equivalent(circuit, same)

circuit.append(cirq.measure(a))
mutable_circuit = circuit.copy()
mutable_circuit.append(cirq.measure(a))
same.append(cirq.measure(a))
cirq.testing.assert_circuits_with_terminal_measurements_are_equivalent(circuit, same)
cirq.testing.assert_circuits_with_terminal_measurements_are_equivalent(mutable_circuit, same)


def test_correct_qubit_ordering():
Expand Down