Пример #1
0
def test_acquaintance_device():
    with pytest.raises(ValueError):
        op = cirq.X(cirq.NamedQubit('q'))
        cca.UnconstrainedAcquaintanceDevice.validate_operation(op)

    qubits = cirq.LineQubit.range(4)
    ACQUAINT = cca.AcquaintanceOpportunityGate()
    swap_network = cca.SwapNetworkGate((1, 2, 1))
    cca.UnconstrainedAcquaintanceDevice.validate_operation(
        ACQUAINT(*qubits[:2]))
    cca.UnconstrainedAcquaintanceDevice.validate_operation(
        swap_network(*qubits))
Пример #2
0
def test_acquaintance_gate_repr():
    assert (repr(cca.AcquaintanceOpportunityGate(2)) ==
            'cirq.contrib.acquaintance.AcquaintanceOpportunityGate'
            '(num_qubits=2)')