Best Python code snippet using lisa_python
test_climate.py
Source:test_climate.py
...199 def test_basin_location(self):200 locs = [302, "301"]201 dataset = self.api.get_instrumental("pr", "decade", locs)202 self.assertTrue(dataset.api_call_date)203 def test_multiple_locations(self):204 locs = ["GB", 302]205 dataset = self.api.get_instrumental("pr", "decade", locs)206 regions = [resp["region"][0] for resp in dataset.api_calls]207 self.assertIn("GB", regions)208 self.assertIn("302", regions)209@ddt210class TestModelledFn(TestClimateAPI):211 def test_precip_type(self):212 locs = ["US"]213 dataset = self.api.get_modelled("pr", "mavg", locs)214 self.assertTrue(dataset.as_dict())215 def test_temp_type(self):216 locs = ["AF"]217 dataset = self.api.get_modelled("tas", "mavg", locs)218 self.assertIn("tas", dataset.data_type)219 @data("ppt_days", "tmin_means", "ppt_days90th")220 def test_derived_statistic_type(self, stat):221 locs = ["AF", 303]222 dataset = self.api.get_modelled(stat, "mavg", locs)223 self.assertTrue(dataset.as_dict())224 def test_aavg_interval(self):225 locs = ["AF"]226 dataset = self.api.get_modelled("tas", "aavg", locs)227 self.assertTrue(dataset.as_dict())228 def test_manom_interval(self):229 locs = [302]230 dataset = self.api.get_modelled("tas", "manom", locs)231 self.assertTrue(dataset.as_dict())232 def test_aanom_interval(self):233 locs = ["AF"]234 dataset = self.api.get_modelled("tas", "aanom", locs)235 self.assertTrue(dataset.as_dict())236 def test_value(self):237 locs = ["nzl"]238 dataset = self.api.get_modelled("tmin_means", "mavg", locs)239 res = dataset.as_dict(sres="b1")240 self.assertEqual(res["ensemble_90"]["NZ"]["2065"][11],241 14.541015999650355)242 def test_bad_request_raises_exc(self):243 def bad_req():244 locs = ["GB", "303"]245 dataset = self.api.get_modelled("prr", "mavg", locs)246 self.assertRaises(AssertionError, bad_req)247 def test_multiple_locations(self):248 locs = ["GB", 302]249 dataset = self.api.get_modelled("pr", "aanom", locs)250 regions = [resp["region"][0] for resp in dataset.api_calls]251 self.assertIn("GB", regions)252 self.assertIn("302", regions)253class TestLocationCodes(TestClimateAPI):254 def test_alpha2_codes_work_as_location_arg(self):255 locs = ["GB"]256 dataset = self.api.get_modelled("tas", "aanom", locs)257 self.assertTrue(dataset.as_dict())258 def test_alpha3_codes_work_as_location_arg(self):259 locs = ["GBR"]260 dataset = self.api.get_modelled("tas", "aanom", locs)261 self.assertTrue(dataset.as_dict())...
test_utils.py
Source:test_utils.py
...17 def test_single_location(self):18 self.position.location = 'Los Angeles'19 meta = generate_position_meta_description(self.position)20 self.assertEqual(meta, 'Mozilla is hiring a full time Bowler in Los Angeles')21 def test_multiple_locations(self):22 self.position.location = 'Los Angeles,Ralphs,In-N-Out'23 meta = generate_position_meta_description(self.position)24 self.assertEqual(...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!