Example #1
0
def test_update_argparser_error():
    with pytest.raises(TypeError) as exc_info:
        update_argparser(12, argparser=argparse.ArgumentParser())
    assert str(exc_info.value) == "12: not a schema"
Example #2
0
def test_help_default_gall(tparser, tschema):
    update_argparser(tschema, tparser, group_depth=-1)
    stream = io.StringIO()
    tparser.print_help(stream)
    print(stream.getvalue())
    assert stream.getvalue() == """\
Example #3
0
def test_update_argparser():
    parser = argparse.ArgumentParser()
    parser.add_argument("--alpha")
    update_argparser(Schema(), parser)
    namespace = parser.parse_args(["--alpha=2"])
    assert namespace.alpha == "2"