def test_formatter(self): parser = test_arg_parser(ManPageFormatter) self.assertEqual( parser.format_help(), "usage: {0} [-h] [-a A] arg1\n\n{1}\n\n" "positional arguments:\n" " arg1\n\n" "optional arguments:\n" " \\fB-h\\fR, \\fB--help\\fR\n" " show this help message and exit\n" " \\fB-a\\fR \\fIA\\fR\n" .format(app_name, app_description)) parser = ManPageFormatter(app_name, parser=argparse.ArgumentParser( prog=app_name)) today = datetime.date.today().strftime('%Y\\-%m\\-%d') self.assertEqual(parser.format_man_page(), ".TH {0} 1 {1}\n" ".SH NAME\n" "{0}\n" ".SH SYNOPSIS\n" " \\fBname\\fR [-h]\n\n\n" ".SH OPTIONS\n" " -h, --help show this help message and exit\n" .format(app_name, today))
def test_formatter(self): parser = test_arg_parser(ManPageFormatter) self.assertEqual( parser.format_help(), "usage: {0} [-h] [-a A] arg1\n\n{1}\n\n" "positional arguments:\n" " arg1\n\n" "optional arguments:\n" " \\fB-h\\fR, \\fB--help\\fR\n" " show this help message and exit\n" " \\fB-a\\fR \\fIA\\fR\n" .format(app_name, app_description)) parser = ManPageFormatter(app_name, parser=argparse.ArgumentParser(prog=app_name)) today = datetime.date.today().strftime('%Y\\-%m\\-%d') self.assertEqual(parser.format_man_page(), ".TH {0} 1 {1}\n" ".SH NAME\n" "{0}\n" ".SH SYNOPSIS\n" " \\fBname\\fR [-h]\n\n\n" ".SH OPTIONS\n" " -h, --help show this help message and exit\n" .format(app_name, today))
def test_formatter(self): parser = test_arg_parser(ManPageFormatter) self.assertEqual( parser.format_help(), f'usage: {app_name} [-h] [-a A] arg1\n\n{app_description}\n\n' 'positional arguments:\n' ' arg1\n\n' 'optional arguments:\n' ' \\fB-h\\fR, \\fB--help\\fR\n' ' show this help message and exit\n' ' \\fB-a\\fR \\fIA\\fR\n') parser = ManPageFormatter( app_name, parser=argparse.ArgumentParser(prog=app_name)) today = datetime.date.today().strftime('%Y\\-%m\\-%d') self.assertEqual( parser.format_man_page(), f'.TH {app_name} 1 {today}\n' '.SH NAME\n' f'{app_name}\n' '.SH SYNOPSIS\n' ' \\fBname\\fR [-h]\n\n\n' '.SH OPTIONS\n' ' -h, --help show this help message and exit\n')