def test_series_reversion(): R, x, y = ring('x, y', QQ) p = rs_tan(x, x, 10) assert rs_series_reversion(p, x, 8, y) == rs_atan(y, y, 8) p = rs_sin(x, x, 10) assert rs_series_reversion(p, x, 8, y) == 5*y**7/112 + 3*y**5/40 + \ y**3/6 + y