diff --git a/cirq/protocols/approximate_equality_protocol_test.py b/cirq/protocols/approximate_equality_protocol_test.py index 7d8f8319143..57435be748d 100644 --- a/cirq/protocols/approximate_equality_protocol_test.py +++ b/cirq/protocols/approximate_equality_protocol_test.py @@ -47,11 +47,11 @@ def test_approx_eq_mixed_primitives(): def test_numpy_dtype_compatibility(): i_a, i_b, i_c = 0, 1, 2 - i_types = [np.intc, np.intp, np.int0, np.int8, np.int16, np.int32, np.int64] + i_types = [np.intc, np.intp, np.int8, np.int16, np.int32, np.int64] for i_type in i_types: assert cirq.approx_eq(i_type(i_a), i_type(i_b), atol=1) assert not cirq.approx_eq(i_type(i_a), i_type(i_c), atol=1) - u_types = [np.uint, np.uint0, np.uint8, np.uint16, np.uint32, np.uint64] + u_types = [np.uint, np.uintp, np.uint8, np.uint16, np.uint32, np.uint64] for u_type in u_types: assert cirq.approx_eq(u_type(i_a), u_type(i_b), atol=1) assert not cirq.approx_eq(u_type(i_a), u_type(i_c), atol=1) diff --git a/cirq/protocols/resolve_parameters.py b/cirq/protocols/resolve_parameters.py index 3243f26b555..cc515f45522 100644 --- a/cirq/protocols/resolve_parameters.py +++ b/cirq/protocols/resolve_parameters.py @@ -178,8 +178,10 @@ def resolve_parameters( if isinstance(val, (list, tuple)): return cast(T, type(val)(resolve_parameters(e, param_resolver, recursive) for e in val)) - is_parameterized = getattr(val, '_is_parameterized_', None) - if is_parameterized is not None and not is_parameterized(): + is_parameterized = ( + val._is_parameterized_() if hasattr(val, '_is_parameterized_') else NotImplemented + ) + if is_parameterized is not NotImplemented and not is_parameterized: return val getter = getattr(val, '_resolve_parameters_', None) diff --git a/cirq/sim/simulation_state_test.py b/cirq/sim/simulation_state_test.py index eab1e884676..f493c1f1435 100644 --- a/cirq/sim/simulation_state_test.py +++ b/cirq/sim/simulation_state_test.py @@ -43,8 +43,8 @@ def _act_on_fallback_( return True def add_qubits(self, qubits): - ret = super().add_qubits(qubits) - return self if NotImplemented else ret + super().add_qubits(qubits) + return self class DelegatingAncillaZ(cirq.Gate):