def test_single_string_option(): o = Option("t", short="-t", nargs=1) assert str(o) == "" assert o.to_cmd() == "" o.value = "test" assert str(o) == "test" assert o.to_cmd() == "-t test"
def test_list_string_option(): o = Option("t", short="-t", nargs="*") assert str(o) == "" o.value = "test" assert str(o) == "test" assert o.to_cmd() == "-t test" o.value = ["t1", "t2"] assert str(o) == "t1 t2" assert o.to_cmd() == "-t t1 t2"
def test_boolean_option(): o = Option("t", short="-t", default=False) assert o.name == "t" assert o.short == "-t" assert not o.default assert o.value == [False] assert str(o) == "" assert o.to_cmd() == "" o.value = True assert str(o) == "" assert o.to_cmd() == "-t"
def test_hidden_option(): o = Option("output", short="-o", hidden=True, value="Test") assert o.to_cmd() == "-o Test"
def test_hidden_option(): o = Option("output", short="-o", hidden=True, value='Test') assert o.to_cmd() == '-o Test'