def test9_complex_documentation(self): #"""Simple test: no keyword arguments or return values""" @pyomo_api def test9(data): """ This is the short documentation. This is the long documentation. Required: data: multiline description of input data object data.a: More data """ data.a = 2 data.b[0] = 2 # options = PyomoAPIData() options.a = 1 options.b = [1, 2] retval = test9(options) self.assertEqual(retval.data.a, 2) self.assertEqual(retval.data.b, [2, 2]) retval = test9(data=options) self.assertEqual(retval.data.a, 2) self.assertEqual(retval.data.b, [2, 2]) # self.assertTrue('test1' in PyomoAPIFactory.services()) self.assertEqual(test9.__short_doc__, 'This is the\nshort\ndocumentation.') self.assertEqual(test9.__long_doc__, 'This\n\nis\n\nthe\n\nlong documentation.')
def test1_no_kwds_no_return(self): #"""Simple test: no keyword arguments or return values""" @pyomo_api def test1(data): """ Required: data: input data """ data.a = 2 data.b[0] = 2 # options = PyomoAPIData() options.a = 1 options.b = [1, 2] retval = test1(options) self.assertEqual(retval.data.a, 2) self.assertEqual(retval.data.b, [2, 2]) retval = test1(data=options) self.assertEqual(retval.data.a, 2) self.assertEqual(retval.data.b, [2, 2]) # self.assertTrue('test1' in PyomoAPIFactory.services())
def preprocess(self, preprocessor=None): """Apply the preprocess plugins defined by the user""" with PauseGC() as pgc: if preprocessor is None: preprocessor = self.config.preprocessor PyomoAPIFactory(preprocessor)(self.config, model=self)