Skip to content

Commit

Permalink
Fix t.poplate(random_branches=...) to new api even in dead code.
Browse files Browse the repository at this point in the history
So even for code that is not really working, now we have it with
the right way of calling it.

It was particularly important in these "interactive" tests:
  tests/test_treeview/phylotree_visualization.py
  tests/test_treeview/test_all_treeview.py
  • Loading branch information
jordibc committed Mar 7, 2024
1 parent af776fa commit 735db7a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
5 changes: 4 additions & 1 deletion ete4/tools/ete_generate.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import random

from .common import dump

DESC = ""
Expand All @@ -13,5 +15,6 @@ def run(args):

for n in range(args.number):
t = Tree()
t.populate(args.size, random_branches=args.random_branches)
fn = random.random if args.random_branches else None
t.populate(args.size, dist_fn=fn, support_fn=fn)
dump(t)
2 changes: 1 addition & 1 deletion tests/test_treeview/bubble_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def layout(node):
def get_example_tree():
# Random tree
t = Tree()
t.populate(20, random_branches=True)
t.populate(20, dist_fn=random.random, support_fn=random.random)

# Some random features in all nodes
for n in t.traverse():
Expand Down
3 changes: 2 additions & 1 deletion tests/test_treeview/test_all_treeview.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import unittest
import sys
import os
import random

ETEPATH = os.path.abspath(os.path.split(os.path.realpath(__file__))[0]+'/../')
sys.path.insert(0, ETEPATH)
Expand Down Expand Up @@ -144,7 +145,7 @@ def layout(node):
faces.add_face_to_node(F2 ,node, 1, position="branch-right")
CONT += 1
t = Tree()
t.populate(20, random_branches=True)
t.populate(20, dist_fn=random.random, support_fn=random.random)
ts = TreeStyle()
ts.layout_fn = layout
ts.mode = "c"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_treeview/tree_faces.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def layout(node):
def get_example_tree():
# Random tree
t = Tree()
t.populate(20, random_branches=True)
t.populate(20, dist_fn=random.random, support_fn=random.random)

# Some random properties in all nodes
for n in t.traverse():
Expand Down

0 comments on commit 735db7a

Please sign in to comment.