How to use __test_parsing_all_good method in autotest

Best Python code snippet using autotest_python

topic_common_unittest.py

Source:topic_common_unittest.py Github

copy

Full Screen

...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.name92 self.__test_parsing_flist_good(opt(), ['a', 'b', 'c', 'd', 'e', 'f'])93 def test_file_list_one_line_mix(self):94 class opt(object):95 flist_obj = cli_mock.create_file('a,b c\nd,e\nf\ng h,i')96 flist = flist_obj.name97 self.__test_parsing_flist_good(opt(), ['a', 'b', 'c', 'd', 'e',98 'f', 'g', 'h', 'i'])99 def test_file_list_one_line_comma_space(self):100 class opt(object):101 flist_obj = cli_mock.create_file('a, b c\nd,e\nf\ng h,i')102 flist = flist_obj.name103 self.__test_parsing_flist_good(opt(), ['a', 'b', 'c', 'd', 'e',104 'f', 'g', 'h', 'i'])105 def test_file_list_line_end_comma_space(self):106 class opt(object):107 flist_obj = cli_mock.create_file('a, b c\nd,e, \nf,\ng h,i ,')108 flist = flist_obj.name109 self.__test_parsing_flist_good(opt(), ['a', 'b', 'c', 'd', 'e',110 'f', 'g', 'h', 'i'])111 def test_file_list_no_eof(self):112 class opt(object):113 flist_obj = cli_mock.create_file('a\nb\nc')114 flist = flist_obj.name115 self.__test_parsing_flist_good(opt(), ['a', 'b', 'c'])116 def test_file_list_blank_line(self):117 class opt(object):118 flist_obj = cli_mock.create_file('\na\nb\n\nc\n')119 flist = flist_obj.name120 self.__test_parsing_flist_good(opt(), ['a', 'b', 'c'])121 def test_file_list_escaped_commas(self):122 class opt(object):123 flist_obj = cli_mock.create_file('a\nb\\,c\\,d\nef\\,g')124 flist = flist_obj.name125 self.__test_parsing_flist_good(opt(), ['a', 'b,c,d', 'ef,g'])126 def test_file_list_escaped_commas_slashes(self):127 class opt(object):128 flist_obj = cli_mock.create_file('a\nb\\\\\\,c\\,d\nef\\\\,g')129 flist = flist_obj.name130 self.__test_parsing_flist_good(opt(), ['a', 'b\\,c,d', 'ef\\', 'g'])131 def test_file_list_opt_list_one(self):132 class opt(object):133 inline = 'a'134 self.__test_parsing_inline_good(opt(), ['a'])135 def test_file_list_opt_list_space(self):136 class opt(object):137 inline = 'a b c'138 self.__test_parsing_inline_good(opt(), ['a', 'b', 'c'])139 def test_file_list_opt_list_mix_space_comma(self):140 class opt(object):141 inline = 'a b,c,d e'142 self.__test_parsing_inline_good(opt(), ['a', 'b', 'c', 'd', 'e'])143 def test_file_list_opt_list_mix_comma_space(self):144 class opt(object):145 inline = 'a b,c, d e'146 self.__test_parsing_inline_good(opt(), ['a', 'b', 'c', 'd', 'e'])147 def test_file_list_opt_list_end_comma_space(self):148 class opt(object):149 inline = 'a b, ,c,, d e, '150 self.__test_parsing_inline_good(opt(), ['a', 'b', 'c', 'd', 'e'])151 def test_file_list_opt_list_escaped_commas(self):152 class opt(object):153 inline = 'a\\,b,c, d'154 self.__test_parsing_inline_good(opt(), ['a,b', 'c', 'd'])155 def test_file_list_opt_list_escaped_commas_slashes(self):156 class opt(object):157 inline = 'a\\,b\\\\\\,c,d,e'158 self.__test_parsing_inline_good(opt(), ['a,b\\,c', 'd', 'e'])159 def test_file_list_add_on_space(self):160 self.__test_parsing_leftover_good(['a','c','b'],161 ['a', 'b', 'c'])162 def test_file_list_add_on_mix_space_comma(self):163 self.__test_parsing_leftover_good(['a', 'c','b,d'],164 ['a', 'b', 'c', 'd'])165 def test_file_list_add_on_mix_comma_space(self):166 self.__test_parsing_leftover_good(['a', 'c', 'b,', 'd'],167 ['a', 'b', 'c', 'd'])168 def test_file_list_add_on_end_comma_space(self):169 self.__test_parsing_leftover_good(['a', 'c', 'b,', 'd,', ','],170 ['a', 'b', 'c', 'd'])171 def test_file_list_add_on_escaped_commas(self):172 self.__test_parsing_leftover_good(['a', 'c', 'b,', 'd\\,e\\,f'],173 ['a', 'b', 'c', 'd,e,f'])174 def test_file_list_add_on_escaped_commas_slashes(self):175 self.__test_parsing_leftover_good(['a', 'c', 'b,', 'd\\\\\\,e,f'],176 ['a', 'b', 'c', 'd\\,e', 'f'])177 def test_file_list_all_opt(self):178 class opt(object):179 flist_obj = cli_mock.create_file('f\ng\nh\n')180 flist = flist_obj.name181 inline = 'a b,c,d e'182 self.__test_parsing_all_good(opt(), ['i', 'j'],183 ['a', 'b', 'c', 'd', 'e',184 'f', 'g', 'h', 'i', 'j'])185 def test_file_list_all_opt_empty_file(self):186 class opt(object):187 flist_obj = cli_mock.create_file('')188 flist = flist_obj.name189 inline = 'a b,c,d e'190 self.__test_parsing_all_bad(opt(), ['i', 'j'])191 def test_file_list_all_opt_in_common(self):192 class opt(object):193 flist_obj = cli_mock.create_file('f\nc\na\n')194 flist = flist_obj.name195 inline = 'a b,c,d e'196 self.__test_parsing_all_good(opt(), ['i','j,d'],197 ['a', 'b', 'c', 'd', 'e', 'f', 'i', 'j'])198 def test_file_list_all_opt_in_common_space(self):199 class opt(object):200 flist_obj = cli_mock.create_file('a b c\nd,e\nf\ng')201 flist = flist_obj.name202 inline = 'a b,c,d h'203 self.__test_parsing_all_good(opt(), ['i','j,d'],204 ['a', 'b', 'c', 'd', 'e',205 'f', 'g', 'h', 'i', 'j'])206 def test_file_list_all_opt_in_common_weird(self):207 class opt(object):208 flist_obj = cli_mock.create_file('a b c\nd,e\nf\ng, \n, ,,')209 flist = flist_obj.name210 inline = 'a b,c,d h, , ,, '211 self.__test_parsing_all_good(opt(), ['i','j,d'],212 ['a', 'b', 'c', 'd', 'e',213 'f', 'g', 'h', 'i', 'j'])214 def test_file_list_all_opt_in_common_escaped_commas(self):215 class opt(object):216 flist_obj = cli_mock.create_file('a\\,b\\,c\nd,e\nf\ng')217 flist = flist_obj.name218 inline = 'a\\,b\\,c,d h'219 self.__test_parsing_all_good(opt(), ['i','j,d'],220 ['a,b,c', 'd', 'e', 'f', 'g', 'h',221 'i', 'j'])222 def test_file_list_all_opt_in_common_escaped_commas_slashes(self):223 class opt(object):224 flist_obj = cli_mock.create_file('a\\,b\\\\\\,c\nd,e\nf,ghi, ,, j,')225 flist = flist_obj.name226 inline = 'a\\,b\\\\\\,c,d h,ijk'227 self.__test_parsing_all_good(opt(), ['i','j,d'],228 ['a,b\\,c', 'd', 'e', 'f', 'ghi', 'h',229 'i', 'j', 'ijk'])230class atest_unittest(cli_mock.cli_unittest):231 def setUp(self):232 super(atest_unittest, self).setUp()233 self.atest = topic_common.atest()234 self.atest.afe = rpc.afe_comm()235 if 'AUTOTEST_WEB' in os.environ:236 del os.environ['AUTOTEST_WEB']237 def tearDown(self):238 self.atest = None239 super(atest_unittest, self).tearDown()240 def test_invalid_arg_kill(self):241 self.atest.kill_on_failure = True...

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