def test_default_lvl(self): """Function: test_default_lvl Description: Test with default level. Arguments: """ with gen_libs.no_std_out(): self.assertFalse(gen_libs.prt_lvl())
def test_std_out2(self): """Function: test_std_out2 Description: Test with printing multiple lines to standard out. Arguments: """ with gen_libs.no_std_out(): self.assertFalse(gen_libs.print_list(self.data2))
def test_print_stdout(self): """Function: test_print_stdout Description: Test with printing data to standard out. Arguments: """ with gen_libs.no_std_out(): self.assertFalse(gen_libs.print_data(self.data))
def test_two_require_one_fail(self): """Function: test_two_require_one_fail Description: Test with two required arguments, but one failure. Arguments: """ with gen_libs.no_std_out(): self.assertTrue( arg_parser.arg_require(self.args_array4, self.opt_req_list3))
def test_empty_argsarray(self): """Function: test_empty_argsarray Description: Test with empty args_array. Arguments: """ with gen_libs.no_std_out(): self.assertTrue( arg_parser.arg_require(self.args_array, self.opt_req_list2))
def test_validate_fail(self): """Function: test_validate_fail Description: Test with one match and is failure. Arguments: """ with gen_libs.no_std_out(): self.assertFalse( arg_parser.arg_validate(self.args_array3, self.valid_func2))
def test_two_match_fail(self): """Function: test_two_match_fail Description: Test with two matches and is failure. Arguments: """ with gen_libs.no_std_out(): self.assertFalse( arg_parser.arg_req_xor(self.args_array3, self.opt_xor_list2))
def test_empty_argsarray(self): """Function: test_empty_argsarray Description: Test with empty dictionary for args_array. Arguments: """ with gen_libs.no_std_out(): self.assertFalse( arg_parser.arg_req_xor(self.args_array, self.opt_xor_list2))
def test_multiple_miss2(self): """Function: test_multiple_miss2 Description: Test with multiple keys with one failure. Arguments: """ with gen_libs.no_std_out(): self.assertFalse( arg_parser.arg_xor_dict(self.args_array7, self.opt_xor_dict3))
def test_both_present(self): """Function: test_both_present Description: Test with both key and list options present. Arguments: """ with gen_libs.no_std_out(): self.assertFalse( arg_parser.arg_xor_dict(self.args_array4, self.opt_xor_dict2))
def test_one_match_between_sets(self): """Function: test_one_match_between_sets Description: Test with one match between sets. Arguments: """ with gen_libs.no_std_out(): arg_parser.arg_file_chk(self.args_array, self.file_chk_list) self.assertFalse(os.path.isfile(self.path_file))
def test_version_option(self): """Function: test_version_option Description: Test with -v option. Arguments: """ with gen_libs.no_std_out(): self.assertTrue( gen_libs.help_func(self.args_array3, self.version, self.func_name))
def test_filecrtlist_not_passed(self): """Function: test_filecrtlist_not_passed Description: Test with file_crt_list not being passed. Arguments: """ with gen_libs.no_std_out(): arg_parser.arg_file_chk(self.args_array, self.file_chk_list) self.assertFalse(os.path.isfile(self.path_file))
def test_filecrtlist_empty_list(self): """Function: test_filecrtlist_empty_list Description: Test with file_crt_list passed with empty list. Arguments: """ with gen_libs.no_std_out(): arg_parser.arg_file_chk(self.args_array, self.file_chk_list, []) self.assertFalse(os.path.isfile(self.path_file))
def test_create_dir_perm(self, mock_os): """Function: test_create_dir_perm Description: Test with permission denied to create directory. Arguments: """ mock_os.makedirs = raise_oserror with gen_libs.no_std_out(): self.assertTrue(arg_parser._make_dir(self.dirname13, self.status))
def test_both_options(self): """Function: test_both_options Description: Test with -h and -v options. Arguments: """ with gen_libs.no_std_out(): self.assertTrue( gen_libs.help_func(self.args_array4, self.version, self.func_name))
def test_name_loop_one_item(self): """Function: test_name_loop_one_item Description: Test with name loop on one item. Arguments: """ with gen_libs.no_std_out(): arg_parser.arg_file_chk(self.args_array, self.file_chk_list) self.assertFalse(os.path.isfile(self.path_file))
def test_isinstance_is_list(self): """Function: test_isinstance_is_list Description: Test with isinstance against a list. Arguments: """ with gen_libs.no_std_out(): arg_parser.arg_file_chk(self.args_array, self.file_chk_list) self.assertFalse(os.path.isfile(self.path_file))
def test_match_no_dir(self): """Function: test_match_no_dir Description: Test with directory does not exist. Arguments: """ with gen_libs.no_std_out(): self.assertTrue( arg_parser.arg_dir_chk_crt(self.args_array2, self.dir_chk_list2))
def test_multiple_miss(self): """Function: test_multiple_miss Description: Test with multiple keys with one not present. Arguments: """ with gen_libs.no_std_out(): self.assertFalse( arg_parser.arg_req_or_lst(self.args_array2, self.opt_or_dict_list3))
def test_create_dir_exist(self, mock_os): """Function: test_create_dir_exist Description: Test with file exist to create directory. Arguments: """ mock_os.makedirs = raise_oserror with gen_libs.no_std_out(): self.assertTrue(arg_parser._make_dir(self.dirname17, self.status))
def test_prt_msg(self, mock_lvl): """Function: test_prt_msg Description: Test prt_msg function. Arguments: """ mock_lvl.return_value = True with gen_libs.no_std_out(): self.assertFalse(gen_libs.prt_msg(self.hdr, self.msg, self.lvl))
def test_missing_option(self): """Function: test_missing_option Description: Test with both key and list options not present. Arguments: """ with gen_libs.no_std_out(): self.assertFalse( arg_parser.arg_req_or_lst(self.args_array7, self.opt_or_dict_list2))
def test_one_match_fail(self): """Function: test_one_match_fail Description: Test with one match and is failure. Arguments: """ with gen_libs.no_std_out(): self.assertFalse( arg_parser.arg_noreq_xor(self.args_array3, self.xor_noreq_list2))
def test_two_match_one_fail(self): """Function: test_two_match_one_fail Description: Test with two matches and one is failure. Arguments: """ with gen_libs.no_std_out(): self.assertFalse( arg_parser.arg_noreq_xor(self.args_array5, self.xor_noreq_list3))
def test_fifty_percent(self): """Function: test_fifty_percent Description: Test update method with 50 percent completed. Arguments: """ bar = gen_class.ProgressBar(self.msg, self.width, self.progress_sym, self.empty_sym) with gen_libs.no_std_out(): self.assertFalse(bar.update(50))
def test_open_fail2(self): """Function: test_open_fail2 Description: Test with no -f in file_crt_list list. Arguments: """ with gen_libs.no_std_out(): self.assertTrue( arg_parser._file_create(self.name, self.option, self.file_crt_list2, self.errno, self.strerror, self.status))
def test_open_fail3(self): """Function: test_open_fail3 Description: Test with unable to open file to write. Arguments: """ with gen_libs.no_std_out(): self.assertTrue( arg_parser._file_create(self.name2, self.option, self.file_crt_list, self.errno, self.strerror, self.status))
def test_open_fail(self): """Function: test_open_fail Description: Test with errno set to non-two value. Arguments: """ with gen_libs.no_std_out(): self.assertTrue( arg_parser._file_create(self.name, self.option, self.file_crt_list, self.errno2, self.strerror, self.status))
def test_print_stdout(self, mock_prt): """Function: test_print_stdout Description: Test with printing data to standard out. Arguments: """ mock_prt.return_value = True with gen_libs.no_std_out(): self.assertFalse(gen_libs.dict_2_std(self.data))