How to use generate_environments method in lisa

Best Python code snippet using lisa_python

test_service_environments.py

Source:test_service_environments.py Github

copy

Full Screen

2from zoo.repos.models import Repository3from zoo.services.models import Service4pytestmark = pytest.mark.django_db5@pytest.fixture6def generate_environments(service_factory, environment_factory):7 service = service_factory(8 id=1,9 name="martinez",10 owner="michaelbennett",11 impact="profit",12 docs_url="https://docsurl",13 pagerduty_service="sales/P019873X9",14 slack_channel="https://slackchannel",15 status="fixed",16 )17 environment_factory(18 id=1,19 service=service,20 name="production",...

Full Screen

Full Screen

test_environments.py

Source:test_environments.py Github

copy

Full Screen

...19 [0.891773, 0.437587, 0.963663]]20 )21 def test_generate_environments_with_initial_guesses(self):22 assert_array_almost_equal(23 self.env_with_initial_guesses.generate_environments(24 num_points=3, seed=0),25 [[0.715189, 0.548814, 0.602763],26 [0.544883, 0.423655, 0.645894],27 [0.891773, 0.437587, 0.963663],28 [0.7, 0.5, 0.6]]29 )30 def test_generate_environments_no_cons(self):31 assert_array_almost_equal(32 self.env_no_cons._generate_raw_environments(3, seed=0),33 self.env_no_cons.generate_environments(3, seed=0),34 )35 @parameterized.expand([36 [[0], [[0.544883, 0.423655, 0.645894],37 [0.891773, 0.437587, 0.963663]]],38 [[1], [[0.715189, 0.548814, 0.602763],39 [0.544883, 0.423655, 0.645894]]],40 [[0, 1], [[0.544883, 0.423655, 0.645894]]]41 ])42 def test_generate_environments_cons(self, cons_id, expected):43 env = environments.Environment(44 num_actions=2, constraints=[self.constraints[i] for i in cons_id])45 assert_array_almost_equal(46 env.generate_environments(3, seed=0),47 expected)48 def test_generate_environment_with_projection(self):49 env = environments.Environment(50 num_actions=2, constraints=self.constraints,51 project_constraint=True)52 assert_array_almost_equal(53 env.generate_environments(3, seed=1),54 [[0.691139, 0.460906, 0.625043],55 [0.597473, 0.394812, 0.659627],56 [0.60716, 0.404473, 0.773788]])57class TestConstraints(TestCase):58 def setUp(self):59 self.mkp = environments.MarkupConstraint(2.)60 self.mkp_lower = environments.MarkupConstraint(2., 1.)61 self.info = environments.InformationConstraint(.01, [.5, .4, .3])62 self.ref_environments = np.array([[.8, .4, .3, .1],63 [.9, .3, .1, .8]])64 def test_markup_constraint(self):65 assert not self.mkp([.5, .6, .33])66 assert self.mkp([.5, .6, .34])67 assert_array_almost_equal(...

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 lisa 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