Best Python code snippet using toolium_python
test_utils.py
Source:test_utils.py
...12 13 def test_get_configured_value_no_configs(self):14 """ If no configs are provided, raise an error """15 with self.assertRaises(BaseException):16 get_configured_value("eggs", [])17 def test_get_configured_value_one_config(self):18 """ look in the config for the correct value """19 config = { "some": "values", "blah": "blue" }20 for attr, value in config.items():21 self.assertEqual(value, get_configured_value(attr, [config]))22 def test_get_configured_value_defined_anything(self):23 """ test case: two configs, and the attr is defined in both.24 The first config should get priority """25 user_config = { "true": True, "zero": 0, "num": 100, "string": "a string" }26 standard_config = { "true": "blap", "zero": 123, "num": "???" }27 for attr, value in user_config.items():28 self.assertEqual(value, get_configured_value(attr, [user_config, standard_config]))29 def test_get_configured_value_undefined_undefined(self):30 """ if the attr is not defined in any configs, raise an error """31 user_config = { "something": 23 }32 standard_config = { "another": "blah" }33 with self.assertRaises(BaseException):34 get_configured_value("something else entirely", [user_config, standard_config])35 def test_get_configured_value_none_anything(self):36 """ if the first config defines the attr as None, return None,37 no matter what the second config says """38 user_config = { "defined": None, "undefined": None }39 standard_config = { "defined": 1 }40 for attr, value in user_config.items():41 self.assertIsNone(get_configured_value(attr, [user_config, standard_config]))42 def test_assign_option_values(self):43 """ test that command line values override configured values, using optparse """44 option_names = ["not_overridden", "overridden"]45 configured_values = { "not_overridden": "configured value", "overridden": "configured value" }46 command_line_values = optparse.Values({ "not_overridden": None, "overridden": "commandline value" })47 resulting_options = optparse.Values() # will contain the result of running assign_option_values48 49 assign_option_values(resulting_options, command_line_values, [configured_values], option_names)50 self.assertTrue(hasattr(resulting_options, "not_overridden"))51 self.assertEqual(resulting_options.not_overridden, configured_values["not_overridden"])52 self.assertTrue(hasattr(resulting_options, "overridden"))53 self.assertEqual(resulting_options.overridden, command_line_values.overridden)54 def test_load_config(self):55 result = load_config(self.config_filename)...
test_axidraw_options.py
Source:test_axidraw_options.py
...9 10 def test_get_configured_value_no_configs(self):11 """ If no configs are provided, raise an error """12 with self.assertRaises(BaseException):13 get_configured_value("eggs", [])14 def test_get_configured_value_one_config(self):15 """ look in the config for the correct value """16 config = { "some": "values", "blah": "blue" }17 for attr, value in config.items():18 self.assertEqual(value, get_configured_value(attr, [config]))19 def test_get_configured_value_defined_anything(self):20 """ test case: two configs, and the attr is defined in both.21 The first config should get priority """22 user_config = { "true": True, "zero": 0, "num": 100, "string": "a string" }23 standard_config = { "true": "blap", "zero": 123, "num": "???" }24 for attr, value in user_config.items():25 self.assertEqual(value, get_configured_value(attr, [user_config, standard_config]))26 def test_get_configured_value_undefined_undefined(self):27 """ if the attr is not defined in any configs, raise an error """28 user_config = { "something": 23 }29 standard_config = { "another": "blah" }30 with self.assertRaises(BaseException):31 get_configured_value("something else entirely", [user_config, standard_config])32 def test_get_configured_value_none_anything(self):33 """ if the first config defines the attr as None, return None,34 no matter what the second config says """35 user_config = { "defined": None, "undefined": None }36 standard_config = { "defined": 1 }37 for attr, value in user_config.items():...
decisions.py
Source:decisions.py
...15 self.job_chain.next_link = self.decide()16 return next(self.job_chain, None)17 def decide(self):18 config = self.link.config19 config_value = self.get_configured_value(config["config_attr"])20 if config_value is None:21 config_value = config["default"]22 next_id = None23 for item in config["choices"]:24 if item["value"] == config_value:25 next_id = item["link_id"]26 break27 logger.debug("Using user selected link %s", next_id)28 self.mark_complete()29 return next_id30 def get_configured_value(self, attr_name):...
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!!