def test_check_parameters_invalid(self, gate: Gate) -> None: with pytest.raises(TypeError): gate.check_parameters('a') # type: ignore with pytest.raises(TypeError): gate.check_parameters(1) # type: ignore if gate.is_parameterized(): with pytest.raises(TypeError): error_list = ['a'] * gate.get_num_params() gate.check_parameters(error_list) # type: ignore with pytest.raises(ValueError): gate.check_parameters(np.random.rand(gate.get_num_params() + 1))
def test_is_parameterized_gate(self, param_gate: Gate) -> None: assert not param_gate.is_constant() assert param_gate.is_parameterized()
def test_is_constant_parameterized(self, gate: Gate) -> None: assert gate.is_constant() or gate.is_parameterized()