def test_bell_split(self):
        """Test the result of a two qubit bell state split by one measurement"""
        # Set test circuit
        self.circuit = ReferenceCircuits.bell()
        # Execute
        result = super().test_run_circuit()
        actual = result.get_statevector_tree()
        initial = actual['value']
        path_0 = actual['path_0']['value']
        path_1 = actual['path_1']['value']

        prob_0 = actual['path_0_probability']
        prob_1 = actual['path_1_probability']

        # initial (before measurement) state is 1/sqrt(2)|00> + 1/sqrt(2)|11>, up to a global phase
        self.assertAlmostEqual((initial[0]), 1 / math.sqrt(2))
        self.assertAlmostEqual((initial[3]), 1 / math.sqrt(2))
        self.assertAlmostEqual((prob_0), 1 / 2)
        self.assertAlmostEqual((prob_1), 1 / 2)
        self.assertEqual(initial[1], 0)
        self.assertEqual(initial[2], 0)
        # path 0 state is |00>, up to a global phase
        self.assertAlmostEqual((path_0[0]), 1)
        self.assertEqual(path_0[1], 0)
        self.assertEqual(path_0[2], 0)
        self.assertEqual(path_0[3], 0)
        # path 1 state is |11>, up to a global phase
        self.assertAlmostEqual((path_1[3]), 1)
        self.assertEqual(path_1[0], 0)
        self.assertEqual(path_1[1], 0)
        self.assertEqual(path_1[2], 0)
    def test_measure_collapse(self):
        """Test final measurement collapses statevector"""
        # Set test circuit
        self.circuit = ReferenceCircuits.bell()
        # Execute
        result = super().test_run_circuit()
        actual = result.get_statevector(self.circuit)

        # The final state should be EITHER |00> OR |11>
        diff_00 = np.linalg.norm(np.array([1, 0, 0, 0]) - actual) ** 2
        diff_11 = np.linalg.norm(np.array([0, 0, 0, 1]) - actual) ** 2
        success = np.allclose([diff_00, diff_11], [0, 2]) or np.allclose([diff_00, diff_11], [2, 0])
        # state is 1/sqrt(2)|00> + 1/sqrt(2)|11>, up to a global phase
        self.assertTrue(success)