mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Allow testing element counts in tool output collections.
This commit is contained in:
@@ -347,10 +347,11 @@ class TestCollectionDef( object ):
|
||||
|
||||
|
||||
class TestCollectionOutputDef( object ):
|
||||
# TODO: do not require XML directly here.
|
||||
|
||||
def __init__( self, name, attrib, element_tests ):
|
||||
self.name = name
|
||||
self.collection_type = attrib.get( "type", None )
|
||||
count = attrib.get("count", None)
|
||||
self.count = int(count) if count is not None else None
|
||||
self.attrib = attrib
|
||||
self.element_tests = element_tests
|
||||
|
||||
@@ -213,6 +213,14 @@ class ToolTestCase( TwillTestCase ):
|
||||
message = template % (name, expected_collection_type, collection_type)
|
||||
raise AssertionError(message)
|
||||
|
||||
expected_element_count = output_collection_def.count
|
||||
if expected_element_count:
|
||||
actual_element_count = len(data_collection[ "elements" ])
|
||||
if expected_element_count != actual_element_count:
|
||||
template = "Expected output collection [%s] to have %s elements, but it had %s."
|
||||
message = template % (name, expected_element_count, actual_element_count)
|
||||
raise AssertionError(message)
|
||||
|
||||
def verify_elements( element_objects, element_tests ):
|
||||
for element_identifier, ( element_outfile, element_attrib ) in element_tests.items():
|
||||
element = get_element( element_objects, element_identifier )
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<element name="l12" value="simple_line.txt" />
|
||||
</collection>
|
||||
</param>
|
||||
<output_collection name="list_output" type="list">
|
||||
<output_collection name="list_output" type="list" count="2">
|
||||
<element name="l11">
|
||||
<assert_contents>
|
||||
<has_text_matching expression="^identifier is l11\n$" />
|
||||
|
||||
Reference in New Issue
Block a user