-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More dataset collection unit testing...
- Loading branch information
Showing
2 changed files
with
68 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from galaxy.model.dataset_collections.structure import get_structure | ||
from galaxy.model.dataset_collections.type_description import CollectionTypeDescriptionFactory | ||
from .test_matching import ( | ||
list_of_lists_instance, | ||
list_paired_instance, | ||
pair_instance, | ||
) | ||
|
||
factory = CollectionTypeDescriptionFactory(None) | ||
|
||
|
||
def test_get_structure_simple(): | ||
paired_type_description = factory.for_collection_type("paired") | ||
tree = get_structure(pair_instance(), paired_type_description) | ||
assert len(tree.children) == 2 | ||
assert tree.children[0][0] == "left" # why not forward? | ||
assert tree.children[0][1].is_leaf | ||
|
||
|
||
def test_get_structure_list_paired_over_paired(): | ||
paired_type_description = factory.for_collection_type("list:paired") | ||
tree = get_structure(list_paired_instance(), paired_type_description, "paired") | ||
assert tree.collection_type_description.collection_type == "list" | ||
assert len(tree.children) == 3 | ||
assert tree.children[0][0] == "data1" | ||
assert tree.children[0][1].is_leaf | ||
|
||
def test_get_structure_list_of_lists(): | ||
list_of_lists_type_description = factory.for_collection_type("list:list") | ||
tree = get_structure(list_of_lists_instance(), list_of_lists_type_description) | ||
assert tree.collection_type_description.collection_type == "list:list" | ||
assert len(tree.children) == 2 | ||
assert tree.children[0][0] == "outer1" | ||
assert not tree.children[0][1].is_leaf | ||
|
||
|
||
def test_get_structure_list_of_lists_over_list(): | ||
list_of_lists_type_description = factory.for_collection_type("list:list") | ||
tree = get_structure(list_of_lists_instance(), list_of_lists_type_description, "list") | ||
assert tree.collection_type_description.collection_type == "list" | ||
assert len(tree.children) == 2 | ||
assert tree.children[0][0] == "outer1" | ||
assert tree.children[0][1].is_leaf |