Warning

This document is for an in-development version of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.

Source code for galaxy.tool_util.verify.asserts.tabular

import re


[docs]def get_first_line(output): match = re.search("^(.*)$", output, flags=re.MULTILINE) if match is None: return None else: return match.group(1)
[docs]def assert_has_n_columns(output, n, sep='\t'): """ Asserts the tabular output contains n columns. The optional sep argument specifies the column seperator used to determine the number of columns.""" n = int(n) first_line = get_first_line(output) assert first_line is not None, "Was expecting output with %d columns, but output was empty." % n assert len(first_line.split(sep)) == n, "Output does not have %d columns." % n