Stop premature integral expansion described in issue 2708

Add a test for this issue, and tweak the Integral class to properly hand situations where risch returns an Integral.