def test_units_match(method, t_unit, frequency_unit, y_unit, data):
    t, y, dy = data
    dy = dy.mean()  # scipy only supports constant errors

    t = t * t_unit
    y = y * y_unit
    dy = dy * y_unit
    frequency = np.linspace(0.5, 1.5, 10) * frequency_unit
    PLS = lombscargle(t, y, frequency=frequency,
                      fit_bias=False, method=method)
    assert_equal(PLS.unit, units.dimensionless_unscaled)

    PLS = lombscargle(t, y, dy,
                      frequency=frequency,
                      fit_bias=False, method=method)
    assert_equal(PLS.unit, units.dimensionless_unscaled)