How to use test_create_model method in localstack

Best Python code snippet using localstack_python

test_model.py

Source:test_model.py Github

copy

Full Screen

...5evap = read_csv("tests/data/evap.csv", index_col=0,6 parse_dates=True).squeeze("columns")7obs = read_csv("tests/data/obs.csv", index_col=0,8 parse_dates=True).squeeze("columns")9def test_create_model():10 ml = ps.Model(obs, name="Test_Model")11 return ml12def test_add_stressmodel():13 ml = test_create_model()14 sm = ps.RechargeModel(prec=rain, evap=evap, rfunc=ps.Gamma, name='rch')15 ml.add_stressmodel(sm)16 return ml17def test_add_stressmodels():18 ml = test_create_model()19 sm1 = ps.StressModel(rain, rfunc=ps.Exponential, name='prec')20 sm2 = ps.StressModel(evap, rfunc=ps.Exponential, name='evap')21 ml.add_stressmodel([sm1, sm2])22 return ml23def test_del_stressmodel():24 ml = test_add_stressmodel()25 ml.del_stressmodel("recharge")26 return27def test_add_constant():28 ml = test_create_model()29 ml.add_constant(ps.Constant())30 return31def test_del_constant():32 ml = test_create_model()33 ml.del_constant()34 return35def test_add_noisemodel():36 ml = test_create_model()37 ml.add_noisemodel(ps.NoiseModel())38 return39def test_armamodel():40 ml = test_create_model()41 ml.add_noisemodel(ps.ArmaModel())42 ml.solve()43 return44def test_del_noisemodel():45 ml = test_create_model()46 ml.del_noisemodel()47 return48def test_solve_model():49 ml = test_add_stressmodel()50 ml.solve()51 return ml52def test_solve_empty_model():53 ml = test_add_stressmodel()54 try:55 ml.solve(tmin="2016")56 except ValueError as e:57 if e.args[0].startswith("Calibration series "):58 return59 else:60 raise e61def test_save_model():62 ml = test_create_model()63 ml.to_file("test.pas")64 return65def test_load_model():66 ml = test_solve_model()67 # add some fictitious tiny value for testing float precision68 ml.parameters.loc["rch_f", "pmax"] = 1.23456789e-1069 ml.to_file("test.pas")70 ml2 = ps.io.load("test.pas")71 # dataframe dtypes don't match... make the same here72 # this is caused because the parameters df is loaded empty without73 # information on the datatype in each column74 for icol in ["initial", "optimal", "pmin", "pmax", "stderr"]:75 ml.parameters[icol] = ml.parameters[icol].astype(float)76 ml.parameters["vary"] = ml.parameters["vary"].astype(bool)77 78 # check if parameters and pcov dataframes are equal79 assert ml.parameters.equals(ml2.parameters)80 assert ml.fit.pcov.equals(ml2.fit.pcov)81 return82def test_model_copy():83 ml = test_create_model()84 ml.copy()85 return86def test_get_block():87 ml = test_add_stressmodel()88 ml.get_block_response("recharge")89 return90def test_get_step():91 ml = test_add_stressmodel()92 ml.get_step_response("recharge")93 return94def test_get_contribution():95 ml = test_add_stressmodel()96 ml.get_contribution("recharge")97 return...

Full Screen

Full Screen

test_models.py

Source:test_models.py Github

copy

Full Screen

...6except ImportError:7 from django.utils.encoding import smart_text as smart_unicode8from pagseguro.models import Checkout, Transaction, TransactionHistory9class CheckoutTest(TestCase):10 def test_create_model(self):11 checkout = Checkout.objects.create(12 code='007',13 date=timezone.now(),14 success=True15 )16 self.assertEqual(17 smart_unicode(checkout), '{0}'.format(checkout.pk)18 )19class TransactionTest(TestCase):20 def test_create_model(self):21 transaction = Transaction.objects.create(22 code='007',23 reference='nothing',24 status='aguardando',25 date=timezone.now(),26 last_event_date=timezone.now()27 )28 self.assertEqual(29 smart_unicode(transaction), transaction.code30 )31class TransactionHistoryTest(TestCase):32 def test_create_model(self):33 transaction = Transaction.objects.create(34 code='007',35 reference='nothing',36 status='aguardando',37 date=timezone.now(),38 last_event_date=timezone.now()39 )40 tx_history = TransactionHistory.objects.create(41 transaction=transaction,42 date=timezone.now(),43 status='aguardando'44 )45 self.assertEqual(46 smart_unicode(tx_history),...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful