Best Python code snippet using autotest_python
topic_common_unittest.py
Source:topic_common_unittest.py
...20 self.assertEquals(3, get_item_key({'a': {'b': {'c': 3}}}, 'a.b.c'))21 self.assertEquals(5, get_item_key({'a': 5}, 'a'))22 self.assertEquals({'b': 9}, get_item_key({'a': {'b': 9}}, 'a'))23class item_parse_info_unittest(cli_mock.cli_unittest):24 def __test_parsing_flist_bad(self, options):25 parse_info = topic_common.item_parse_info26 test_parse_info = parse_info(attribute_name='testing',27 filename_option='flist')28 self.assertRaises(topic_common.CliError,29 test_parse_info.get_values, options, [])30 def __test_parsing_flist_good(self, options, expected):31 parse_info = topic_common.item_parse_info32 test_parse_info = parse_info(attribute_name='testing',33 filename_option='flist')34 result, leftover = test_parse_info.get_values(options, [])35 self.assertEqualNoOrder(expected, result)36 os.unlink(options.flist)37 def __test_parsing_inline_good(self, options, expected):38 parse_info = topic_common.item_parse_info39 test_parse_info = parse_info(attribute_name='testing',40 inline_option='inline')41 result, leftover = test_parse_info.get_values(options, [])42 self.assertEqualNoOrder(expected, result)43 def __test_parsing_leftover_good(self, leftover, expected):44 class opt(object):45 pass46 parse_info = topic_common.item_parse_info47 test_parse_info = parse_info(attribute_name='testing',48 inline_option='inline',49 use_leftover=True)50 result, leftover = test_parse_info.get_values(opt(), leftover)51 self.assertEqualNoOrder(expected, result)52 def __test_parsing_all_good(self, options, leftover, expected):53 parse_info = topic_common.item_parse_info54 test_parse_info = parse_info(attribute_name='testing',55 inline_option='inline',56 filename_option='flist',57 use_leftover=True)58 result, leftover = test_parse_info.get_values(options, leftover)59 self.assertEqualNoOrder(expected, result)60 os.unlink(options.flist)61 def __test_parsing_all_bad(self, options, leftover):62 parse_info = topic_common.item_parse_info63 test_parse_info = parse_info(attribute_name='testing',64 inline_option='inline',65 filename_option='flist',66 use_leftover=True)67 self.assertRaises(topic_common.CliError,68 test_parse_info.get_values, options, leftover)69 def test_file_list_wrong_file(self):70 class opt(object):71 flist = './does_not_exist'72 self.__test_parsing_flist_bad(opt())73 def test_file_list_empty_file(self):74 class opt(object):75 flist_obj = cli_mock.create_file('')76 flist = flist_obj.name77 self.__test_parsing_flist_bad(opt())78 def test_file_list_ok(self):79 class opt(object):80 flist_obj = cli_mock.create_file('a\nb\nc\n')81 flist = flist_obj.name82 self.__test_parsing_flist_good(opt(), ['a', 'b', 'c'])83 def test_file_list_one_line_space(self):84 class opt(object):85 flist_obj = cli_mock.create_file('a b c\nd e\nf\n')86 flist = flist_obj.name87 self.__test_parsing_flist_good(opt(), ['a', 'b', 'c', 'd', 'e', 'f'])88 def test_file_list_one_line_comma(self):89 class opt(object):90 flist_obj = cli_mock.create_file('a,b,c\nd,e\nf\n')91 flist = flist_obj.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!!