mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #8440 from bgruening/n_lines_validation
add assert for n_lines in tool output verifications
This commit is contained in:
@@ -20,6 +20,12 @@ def assert_has_line(output, line):
|
||||
assert match is not None, "No line of output file was '%s' (output was '%s') " % (line, output)
|
||||
|
||||
|
||||
def assert_has_n_lines(output, n):
|
||||
"""Asserts the specified output contains ``n`` lines."""
|
||||
n_lines_found = len(output.splitlines())
|
||||
assert n_lines_found == int(n), "Expected %s lines in output, found %s lines" % (n, n_lines_found)
|
||||
|
||||
|
||||
def assert_has_text_matching(output, expression):
|
||||
""" Asserts the specified output contains text matching the
|
||||
regular expression specified by the argument expression."""
|
||||
|
||||
@@ -785,6 +785,7 @@ specified and instead a series of assertions is made about the output.
|
||||
<!-- 	 is XML escape code for tab -->
|
||||
<has_line line="chr7	127471195	127489808" />
|
||||
<has_n_columns n="3" />
|
||||
<has_n_lines n="3" />
|
||||
</assert_contents>
|
||||
</output>
|
||||
</test>
|
||||
@@ -1671,6 +1672,12 @@ module.
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element name="has_n_lines" type="xs:anyType">
|
||||
<xs:annotation>
|
||||
<xs:documentation><![CDATA[Asserts that an output contains ``n`` lines, e.g. ``<has_n_lines n="3" />``.]]>
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element name="has_line_matching" type="xs:anyType">
|
||||
<xs:annotation>
|
||||
<xs:documentation><![CDATA[Asserts a line matching the specified regular expression (``expression``) appears in the output (e.g. ``<has_line_matching expression=".*\s+127489808\s+127494553" />``).]]>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<tool id="validation_default" name="Validation (default)">
|
||||
<tool id="validation_default" name="Validation (default)" version="0.1">
|
||||
<command>
|
||||
echo "$input1" > out1;
|
||||
echo '$input1' > out1;
|
||||
echo $float_param > out2;
|
||||
echo $select_param > out3;
|
||||
</command>
|
||||
@@ -25,6 +25,7 @@
|
||||
<output name="out_file1">
|
||||
<assert_contents>
|
||||
<has_line line="__dq__ X echo __dq__moo" />
|
||||
<has_n_lines n="1" />
|
||||
</assert_contents>
|
||||
</output>
|
||||
</test>
|
||||
|
||||
Reference in New Issue
Block a user