-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also move the tree tests to the integration suite, since we're doing network connections.
- Loading branch information
Showing
3 changed files
with
74 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from urllib.parse import urlparse | ||
|
||
import pytest | ||
from cladetime import CladeTime, Tree | ||
from cladetime.exceptions import TreeNotAvailableError | ||
from freezegun import freeze_time | ||
|
||
|
||
def test__get_tree_url(): | ||
with freeze_time("2024-08-13 16:21:34"): | ||
tree = Tree(CladeTime()) | ||
tree_url_parts = urlparse(tree.url) | ||
assert "2024-07-17--12-57-03Z" in tree_url_parts.path | ||
assert "tree.json" in tree_url_parts.path | ||
|
||
|
||
def test__get_tree_url_bad_date(): | ||
# we cannot get reference trees prior to 2024-08-01 | ||
with pytest.raises(TreeNotAvailableError): | ||
Tree(CladeTime(tree_as_of="2024-07-13")) | ||
|
||
|
||
def test__get_reference_tree(): | ||
with freeze_time("2024-08-13 16:21:34"): | ||
tree = Tree(CladeTime()) | ||
assert tree.tree.get("meta", "").get("title", "").lower() == "sars-cov-2 phylogeny" |