def test_newick__get_leaf_nodes__complex_case(): node_a = Newick(name = "Leaf A") node_b = Newick(name = "Leaf B") node_c = Newick(name = "Leaf C") sub_a = Newick(children = [node_b, node_c]) top_node = Newick(children = [node_a, sub_a]) assert_list_equal(top_node.get_leaf_nodes(), [node_a, node_b, node_c])
def test_newick__get_leaf_nodes__complex_case(): node_a = Newick(name="Leaf A") node_b = Newick(name="Leaf B") node_c = Newick(name="Leaf C") sub_a = Newick(children=[node_b, node_c]) top_node = Newick(children=[node_a, sub_a]) assert_list_equal(top_node.get_leaf_nodes(), [node_a, node_b, node_c])
def test_fasta__from_lines__multiple_records(): lines = [">first\n", "TGTTCTCCACCGTGCACAAC\n", "CCTTCATCCA\n", ">Second XT:1:0\n", "GAGAGCTCAGCTAAC\n", ">Third\n", "CGCTGACCAAAAACGGACAG\n", "GGCATTCGGC\n"] expected = [FASTA("first", None, "TGTTCTCCACCGTGCACAACCCTTCATCCA"), FASTA("Second", "XT:1:0", "GAGAGCTCAGCTAAC"), FASTA("Third", None, "CGCTGACCAAAAACGGACAGGGCATTCGGC")] assert_list_equal(FASTA.from_lines(lines), expected)
def test_fasta__from_lines__multiple_records(): lines = [ ">first\n", "TGTTCTCCACCGTGCACAAC\n", "CCTTCATCCA\n", ">Second XT:1:0\n", "GAGAGCTCAGCTAAC\n", ">Third\n", "CGCTGACCAAAAACGGACAG\n", "GGCATTCGGC\n" ] expected = [ FASTA("first", None, "TGTTCTCCACCGTGCACAACCCTTCATCCA"), FASTA("Second", "XT:1:0", "GAGAGCTCAGCTAAC"), FASTA("Third", None, "CGCTGACCAAAAACGGACAGGGCATTCGGC") ] assert_list_equal(FASTA.from_lines(lines), expected)
def test_newick__get_leaf_nodes__internal_node_returns_leaf_nodes(): node_a = Newick(name = "Leaf A") node_b = Newick(name = "Leaf B") top_node = Newick(children = [node_a, node_b]) assert_list_equal(top_node.get_leaf_nodes(), [node_a, node_b])
def test_newick__get_leaf_nodes__leaf_returns_self(): node = Newick(name = "Leaf") assert_list_equal(node.get_leaf_nodes(), [node])
def test_newick__get_leaf_nodes__internal_node_returns_leaf_nodes(): node_a = Newick(name="Leaf A") node_b = Newick(name="Leaf B") top_node = Newick(children=[node_a, node_b]) assert_list_equal(top_node.get_leaf_nodes(), [node_a, node_b])
def test_newick__get_leaf_nodes__leaf_returns_self(): node = Newick(name="Leaf") assert_list_equal(node.get_leaf_nodes(), [node])
def test_fasta__from_lines_single_record(): lines = [">single\n", "TGTTCTCCACCGTGCACAAC\n", "CCTTCATCCA\n"] expected = [FASTA("single", None, "TGTTCTCCACCGTGCACAACCCTTCATCCA")] assert_list_equal(FASTA.from_lines(lines), expected)
def test_fasta__from_lines__no_records(): assert_list_equal(FASTA.from_lines([]), [])