def test_qasm_two_qubit_gate_repr(): gate = QasmTwoQubitGate(QasmUGate(0.1, 0.2, 0.3), QasmUGate(0.4, 0.5, 0.6), 0.7, 0.8, 0.9, QasmUGate(1.0, 1.1, 1.2), QasmUGate(1.3, 1.4, 1.5)) assert repr(gate) == ('QasmTwoQubitGate(QasmUGate(0.1, 0.2, 0.3), ' 'QasmUGate(0.4, 0.5, 0.6), ' '0.7, 0.8, 0.9, ' 'QasmUGate(1.0, 1.1, 1.2), ' 'QasmUGate(1.3, 1.4, 1.5))')
def test_qasm_two_qubit_gate_unitary(): u = cirq.testing.random_unitary(4) g = QasmTwoQubitGate.from_matrix(u) np.testing.assert_allclose(cirq.unitary(g), u)
def test_qasm_two_qubit_gate_repr(): cirq.testing.assert_equivalent_repr(QasmTwoQubitGate.from_matrix( cirq.testing.random_unitary(4)))