How to use __test_parsing_leftover_good method in autotest

Best Python code snippet using autotest_python

topic_common_unittest.py

Source:topic_common_unittest.py Github

copy

Full Screen

...39 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.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'...

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