def test_custom_inverse():
 p = models.Polynomial1D(1, c0=(-2), c1=3)
 inv = models.Polynomial1D(1, c0=(2.0 / 3.0), c1=(1.0 / 3.0))
 with pytest.raises(NotImplementedError):
  p.inverse
 p.inverse = inv
 x = np.arange(100)
 assert_allclose(x, p(p.inverse(x)))
 assert_allclose(x, p.inverse(p(x)))
 with catch_warnings(AstropyDeprecationWarning) as w:
  p.inverse = None
 assert (len(w) == 1)
 with pytest.raises(NotImplementedError):
  p.inverse

def test_custom_inverse ( ) : p = models . Polynomial1D ( 1 , c0 = ( - 2 ) , c1 = 3 ) inv = models . Polynomial1D ( 1 , c0 = ( 2.0 / 3.0 ) , c1 = ( 1.0 / 3.0 ) ) with pytest . raises ( NotImplementedError ) : p . inverse p . inverse = inv x = np . arange ( 100 ) assert_allclose ( x , p ( p . inverse ( x ) ) ) assert_allclose ( x , p . inverse ( p ( x ) ) ) with catch_warnings ( AstropyDeprecationWarning ) as w : p . inverse = None assert ( len ( w ) == 1 ) with pytest . raises ( NotImplementedError ) : p . inverse
test setting a custom inverse on a model .