def test_create_argparser_prefix_str(prefix): fqname = _make_fqname(prefix) + ("xval",) argname = argument_name(fqname) argdest = argument_dest(fqname) schema = Schema.from_string("""\ xval = Int(doc="x value") """, fmt="zirkon") parser = create_argparser(schema, prefix=prefix) namespace = parser.parse_args(["{}=2".format(argname)]) assert getattr(namespace, argdest) == 2
def test_argument_name_int_error(): with pytest.raises(TypeError): argument_name(10)
def test_argument_name_str(): assert argument_name("a.b") == "--a-b"
def test_argument_name_None(): assert argument_name(None) == "--"
def test_argument_name_tuple(): assert argument_name(('a', 'b')) == "--a-b"
def test_argument_name(): assert argument_name(("alpha", "max_value")) == "--alpha-max_value"