def METHOD_NAME(self):
    """Test the cx cancellation pass.
    It should cancel consecutive cx pairs on same qubits.
    """
    qr = QuantumRegister(2)
    circuit = QuantumCircuit(qr)
    circuit.h(qr[0])
    circuit.h(qr[0])
    circuit.cx(qr[0], qr[1])
    circuit.cx(qr[0], qr[1])
    circuit.cx(qr[0], qr[1])
    circuit.cx(qr[0], qr[1])
    circuit.cx(qr[1], qr[0])
    circuit.cx(qr[1], qr[0])
    pass_manager = PassManager()
    pass_manager.append(CXCancellation())
    out_circuit = pass_manager.run(circuit)
    expected = QuantumCircuit(qr)
    expected.h(qr[0])
    expected.h(qr[0])
    self.assertEqual(out_circuit, expected)