def test_beast_vector_annotated_nexus_output_cat(): lines = fileinput.input("tests/treefiles/beast_output_geo_annotations.nex") trees = ComplexNewickParser().consume(lines) trees = Cat().consume(trees) for t in trees: for n in t.traverse(): assert hasattr(n, "location")
def test_init(): # Test defaults cat = Cat.init_from_args("") assert cat.burnin == 0 assert cat.subsample == 1 assert cat.annotations == True # Test burnin cat = Cat.init_from_args("--burnin 10") assert cat.burnin == 10 # Test subsample cat = Cat.init_from_args("--subsample 10") assert cat.subsample == 10 # Test no annotations cat = Cat.init_from_args("--no-annotations") assert cat.annotations == False
def test_beast_annotated_nexus_output_cat(): lines = fileinput.input( "tests/treefiles/beast_output_rate_annotations.nex") trees = ComplexNewickParser().consume(lines) trees = Cat().consume(trees) for t in trees: for n in t.traverse(): assert hasattr(n, "rate") assert len(t.get_leaves()) == 26
def test_beast_nexus_output_cat(treefilenewick): trees = Cat().consume(treefilenewick('beast_output.nex')) for t in trees: assert len(t.get_leaves()) == 26
def test_basic_cat(basictrees): trees = Cat().consume(basictrees) assert sum((1 for _ in trees)) == 6
def test_mr_bayes_nexus_output_cat(treefilenewick): trees = Cat().consume(treefilenewick('mr_bayes_output.nex')) for t in trees: assert len(t.get_leaves()) == 12
def test_beast_vector_annotated_nexus_output_cat(treefilenewick): trees = Cat().consume(treefilenewick('beast_output_geo_annotations.nex')) for t in trees: for n in t.traverse(): assert hasattr(n, "location")
def test_beast_annotated_nexus_output_cat(treefilenewick): trees = Cat().consume(treefilenewick('beast_output_rate_annotations.nex')) for t in trees: for n in t.traverse(): assert hasattr(n, "rate") assert len(t.get_leaves()) == 26
def test_command_bad_args(): with pytest.raises(SystemExit): run_command('sibling') with pytest.raises(SystemExit): _ = Cat.init_from_args("cat --foobar")
def test_command_bad_args(): cat = Cat.init_from_args("cat --foobar")
def test_mr_bayes_nexus_output_cat(): lines = fileinput.input("tests/treefiles/mr_bayes_output.nex") trees = ComplexNewickParser().consume(lines) trees = Cat().consume(trees) for t in trees: assert len(t.get_leaves()) == 12
def test_burnin(): lines = fileinput.input("tests/treefiles/basic.trees") trees = NewickParser().consume(lines) burntin = Cat(burnin=50).consume(trees) assert sum((1 for t in burntin)) == 3
def test_basic_cat(): lines = fileinput.input("tests/treefiles/basic.trees") trees = NewickParser().consume(lines) subsampled = Cat(subsample=2).consume(trees) assert sum((1 for t in subsampled)) == 3