Skip to content

Commit

Permalink
Add unifurcation test
Browse files Browse the repository at this point in the history
  • Loading branch information
emilydolson committed Jul 15, 2024
1 parent 183c7bc commit 77af905
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/test_systematics.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,3 +468,26 @@ class Organism():
org0 = Organism()
org0.genotype
syst.add_org(org0)


def test_collapse_unifurcations():
org_info_1, org_info_2 = [1, 2]
sys = systematics.Systematics(taxon_info_fun, True, True, False, False)
assert sys.get_collapse_unifurcations() is False
sys.set_collapse_unifurcations(True)
assert sys.get_collapse_unifurcations() is True
org = ExampleOrg(org_info_1)
org2 = ExampleOrg(org_info_2)
org_tax = sys.add_org(org)
org2_tax = sys.add_org(org2, org_tax)
org3_tax = sys.add_org(org2, org_tax)
sys.remove_org(org_tax)
org4_tax = sys.add_org(org, org2_tax)
org5_tax = sys.add_org(org, org4_tax)
assert sys.get_num_ancestors() == 1
sys.remove_org(org2_tax)
assert sys.get_num_ancestors() == 1
sys.remove_org(org4_tax)
assert sys.get_num_ancestors() == 1
sys.remove_org(org5_tax)
assert sys.get_num_ancestors() == 0

0 comments on commit 77af905

Please sign in to comment.