def test_compose() -> None:
    """Tests that cirq.resolve_parameters on a ParamResolver composes."""
    a = sympy.Symbol('a')
    b = sympy.Symbol('b')
    c = sympy.Symbol('c')
    d = sympy.Symbol('d')
    r1 = cirq.ParamResolver({a: b})
    r2 = cirq.ParamResolver({b: c + d})
    r3 = cirq.ParamResolver({c: 12})

    r12 = cirq.resolve_parameters(r1, r2)
    assert r12.value_of('a') == c + d

    r23 = cirq.resolve_parameters(r2, r3)
    assert sympy.Eq(r23.value_of('b'), 12 + d)

    r123 = cirq.resolve_parameters(r12, r3)
    assert sympy.Eq(r123.value_of('a'), 12 + d)

    r13 = cirq.resolve_parameters(r1, r3)
    assert r13.value_of('a') == b
Tests that cirq.resolve_parameters on a ParamResolver composes.
cirq-core/cirq/study/resolver_test.py