Ejemplo n.º 1
0
def test_init_from_args(argfilepath):
    prune = Prune.init_from_args("A,B,C")
    assert prune.opts.filename == None
    assert prune.opts.attribute == None
    assert prune.opts.values == None
    assert prune.opts.inverse == False

    prune = Prune.init_from_args("A,B,C --inverse")
    assert prune.opts.inverse == True

    taxa_abc = argfilepath('taxa_abc.txt')
    prune = Prune.init_from_args("--file {0}".format(taxa_abc))
    assert prune.opts.filename == taxa_abc
    assert prune.opts.attribute == None
    assert prune.opts.values == None

    prune = Prune.init_from_args("--attribute foo --values bar")
    assert prune.opts.filename == None
    assert prune.opts.attribute == "foo"
    assert prune.opts.values == ["bar"]
Ejemplo n.º 2
0
def test_init_from_args():
    prune = Prune.init_from_args("A,B,C")
    assert prune.taxa == set(("A","B","C"))
    assert prune.filename == None
    assert prune.attribute == None
    assert prune.value == None
    assert prune.inverse == False

    prune = Prune.init_from_args("A,B,C --inverse")
    assert prune.inverse == True

    prune = Prune.init_from_args("--file tests/argfiles/taxa_abc.txt")
    assert prune.taxa == set(("A","B","C"))
    assert prune.filename == "tests/argfiles/taxa_abc.txt"
    assert prune.attribute == None
    assert prune.value == None

    prune = Prune.init_from_args("--attribute foo --value bar")
    assert prune.taxa == []
    assert prune.filename == None
    assert prune.attribute == "foo"
    assert prune.value == "bar"