def test_custom_model_subclass():
 @custom_model
 def model_a(x, a=1):
  return (x * a)
 class model_b(model_a, ):
  @classmethod
  def evaluate(cls, x, a):
   return (- super(model_b, cls).evaluate(x, a))
 b = model_b()
 assert (b.param_names == (u'a',))
 assert (b.a == 1)
 assert (b(1) == (-1))
 sig = signature(model_b.__init__)
 assert (list(sig.parameters.keys()) == [u'self', u'a', u'kwargs'])
 sig = signature(model_b.__call__)
 assert (list(sig.parameters.keys()) == [u'self', u'x', u'model_set_axis'])

def test_custom_model_subclass ( ) : @ custom_model def model_a ( x , a = 1 ) : return ( x * a ) class model_b ( model_a , ) : @ classmethod def evaluate ( cls , x , a ) : return ( - super ( model_b , cls ) . evaluate ( x , a ) ) b = model_b ( ) assert ( b . param_names == ( u'a' , ) ) assert ( b . a == 1 ) assert ( b ( 1 ) == ( - 1 ) ) sig = signature ( model_b . __init__ ) assert ( list ( sig . parameters . keys ( ) ) == [ u'self' , u'a' , u'kwargs' ] ) sig = signature ( model_b . __call__ ) assert ( list ( sig . parameters . keys ( ) ) == [ u'self' , u'x' , u'model_set_axis' ] )
test that custom models can be subclassed .