def test_convert_complex(self):
        """Verify that real and complex ParameterExpressions are supported."""
        param = Parameter('test')
        self.assertEqual(IQXJsonEncoder().default(param.bind({param: 0.2})), 0.2)

        val = IQXJsonEncoder().default(param.bind({param: 0.2+0.1j}))
        self.assertEqual(val[0], 0.2)
        self.assertEqual(val[1], 0.1)
 def test_is_parameterized(self):
     """Test checking if a gate is parameterized (bound/unbound)"""
     from qiskit.circuit.library.standard_gates.h import HGate
     from qiskit.circuit.library.standard_gates.rx import RXGate
     theta = Parameter('θ')
     rxg = RXGate(theta)
     self.assertTrue(rxg.is_parameterized())
     theta_bound = theta.bind({theta: 3.14})
     rxg = RXGate(theta_bound)
     self.assertFalse(rxg.is_parameterized())
     h_gate = HGate()
     self.assertFalse(h_gate.is_parameterized())
    def test_cast_to_int_when_bound(self):
        """Verify expression can be cast to an int when fully bound."""

        x = Parameter('x')
        bound_expr = x.bind({x: 2.3})
        self.assertEqual(int(bound_expr), 2)