示例#1
0
def test_required_value_with_default():
    opt = Option("option", flag=False, requires_value=True, default="Default")

    assert not opt.is_flag()
    assert opt.accepts_value()
    assert opt.requires_value()
    assert not opt.is_list()
    assert "Default" == opt.default
示例#2
0
def test_required_value():
    opt = Option("option", flag=False, requires_value=True)

    assert not opt.is_flag()
    assert opt.accepts_value()
    assert opt.requires_value()
    assert not opt.is_list()
    assert opt.default is None
示例#3
0
def test_multi_valued_with_default():
    opt = Option("option", flag=False, is_list=True, default=["foo", "bar"])

    assert not opt.is_flag()
    assert opt.accepts_value()
    assert opt.requires_value()
    assert opt.is_list()
    assert ["foo", "bar"] == opt.default
示例#4
0
def test_list():
    opt = Option("option", flag=False, is_list=True)

    assert not opt.is_flag()
    assert opt.accepts_value()
    assert opt.requires_value()
    assert opt.is_list()
    assert [] == opt.default
示例#5
0
def test_create():
    opt = Option("option")

    assert "option" == opt.name
    assert opt.shortcut is None
    assert opt.is_flag()
    assert not opt.accepts_value()
    assert not opt.requires_value()
    assert not opt.is_list()
    assert not opt.default