do not use RawDescriptionHelpFormatter by default
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
from io import StringIO
|
||||
from contextlib import redirect_stdout, redirect_stderr
|
||||
import pytest
|
||||
from argparse import RawDescriptionHelpFormatter
|
||||
|
||||
|
||||
from tiramisu_cmdline_parser import TiramisuCmdlineParser
|
||||
@ -64,11 +65,31 @@ od:
|
||||
|
||||
{str,list,int,none} choice the sub argument
|
||||
|
||||
two
|
||||
line
|
||||
two line
|
||||
"""
|
||||
parser = TiramisuCmdlineParser(get_config(json), 'prog.py', epilog="\ntwo\nline")
|
||||
f = StringIO()
|
||||
with redirect_stdout(f):
|
||||
parser.print_help()
|
||||
assert f.getvalue() == output
|
||||
|
||||
|
||||
def test_help_epilog_raw(json):
|
||||
output = """usage: prog.py [-h] {str,list,int,none}
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
|
||||
od:
|
||||
od
|
||||
|
||||
{str,list,int,none} choice the sub argument
|
||||
|
||||
two
|
||||
line
|
||||
"""
|
||||
parser = TiramisuCmdlineParser(get_config(json), 'prog.py', epilog="\ntwo\nline", formatter_class=RawDescriptionHelpFormatter)
|
||||
f = StringIO()
|
||||
with redirect_stdout(f):
|
||||
parser.print_help()
|
||||
assert f.getvalue() == output
|
||||
|
Reference in New Issue
Block a user