Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
python-newick
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dlce-eva
python-newick
Commits
825d6f41
Commit
825d6f41
authored
4 years ago
by
Robert Forkel
Browse files
Options
Downloads
Patches
Plain Diff
closes
#27
parent
77c04cb6
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_newick.py
+16
-13
16 additions, 13 deletions
tests/test_newick.py
with
16 additions
and
13 deletions
tests/test_newick.py
+
16
−
13
View file @
825d6f41
...
...
@@ -258,19 +258,22 @@ def test_prune_single_node_tree():
assert
tree
.
newick
==
'
A
'
def
test_redundant_node_removal
():
tree
=
loads
(
'
((B:0.2,(C:0.3,D:0.4)E:0.5)F:0.1)A;
'
)[
0
]
assert
len
(
tree
.
descendants
)
==
1
tree
.
remove_redundant_nodes
()
assert
not
any
([
len
(
n
.
descendants
)
==
1
for
n
in
tree
.
walk
()])
tree
=
loads
(
"
((C)B)A
"
)[
0
]
tree
.
remove_redundant_nodes
(
preserve_lengths
=
False
)
assert
tree
.
newick
==
"
A
"
tree
=
loads
(
"
((C)B)A
"
)[
0
]
tree
.
remove_redundant_nodes
(
preserve_lengths
=
False
,
keep_leaf_name
=
True
)
assert
tree
.
newick
==
"
C
"
@pytest.mark.parametrize
(
'
newick,kw,result
'
,
[
(
'
((B:0.2,(C:0.3,D:0.4)E:0.5)F:0.1)A;
'
,
dict
(),
'
(B:0.2,(C:0.3,D:0.4)E:0.5)A:0.1
'
),
(
'
((C)B)A
'
,
dict
(
preserve_lengths
=
False
),
'
A
'
),
(
'
((C)B)A
'
,
dict
(
preserve_lengths
=
False
,
keep_leaf_name
=
True
),
'
C
'
),
(
'
((aiw),((aas,(kbt)),((abg),abf)))
'
,
dict
(
preserve_lengths
=
False
,
keep_leaf_name
=
True
),
'
(((aas,kbt),(abf,abg)),aiw)
'
),
]
)
def
test_redundant_node_removal
(
newick
,
kw
,
result
):
tree
=
loads
(
newick
)[
0
]
tree
.
remove_redundant_nodes
(
**
kw
)
assert
tree
.
newick
==
result
def
test_prune_and_node_removal
():
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment