def METHOD_NAME():
    tax_base = numpy.array([1, 1.5, 2, 2.5])
    tax_scale = taxscales.MarginalRateTaxScale()
    tax_scale.add_bracket(0, 0)
    tax_scale.add_bracket(1, 0.1)
    tax_scale.add_bracket(2, 0.2)
    result = tax_scale.to_average()
    # Note: assert_near doesn't work for inf.
    assert result.thresholds == [0, 1, 2, numpy.inf]
    assert result.rates, [0, 0, 0.05, 0.2]
    tools.assert_near(
        result.calc(tax_base),
        [0, 0.0375, 0.1, 0.125],
        absolute_error_margin=1e-10,
    )