def test_objects_with_mixture_channel(val, mixture):
    expected_keys, expected_values = zip(*mixture)
    keys, values = zip(*cirq.mixture_channel(val))
    np.testing.assert_almost_equal(keys, expected_keys)
    np.testing.assert_equal(values, expected_values)

    keys, values = zip(*cirq.mixture_channel(val, ((0.3, 'a'), (0.7, 'b'))))
    np.testing.assert_almost_equal(keys, expected_keys)
    np.testing.assert_equal(values, expected_values)
def test_objects_with_no_mixture_channel(val):
    with pytest.raises(TypeError, match="mixture"):
        _ = cirq.mixture_channel(val)
    assert cirq.mixture(val, None) is None
    assert cirq.mixture(val, NotImplemented) is NotImplemented
    default = ((0.4, 'a'), (0.6, 'b'))
    assert cirq.mixture(val, default) == default
def test_deprecated_mixture_channel():
    with cirq.testing.assert_logs('"cirq.mixture"', ' mixture_channel '):
        _ = cirq.mixture_channel(cirq.X)
    with cirq.testing.assert_logs('"cirq.has_mixture"',
                                  ' has_mixture_channel '):
        _ = cirq.has_mixture_channel(cirq.X)