def test_aligned_header_cells_are_not_escaped(self): table = TestCaseTable(None) table.set_header(['test case', 'cus tom', 'header']) table.add('Test case with a long name').add_step( ['keyword here', 'args']) assert_equals(self._formatter.format_header(table), ['*** test case *** ', 'cus \\ tom ', 'header'])
def test_names_on_first_content_row(self): table = TestCaseTable(None) t = table.add('Test') t.add_step(['No op']) extractor = DataExtractor(lambda t, n: True) assert_equals(list(extractor._rows_from_indented_table(table)), [['Test', 'No op']])
def test_counting_column_widths(self): table = TestCaseTable(None) table.set_header(['test cases', 'col header', 'short']) assert_equal(ColumnAligner(18, table)._widths, [18, 10, 5]) test = table.add('A test') test.add_step(['Some kw', 'a longer arg', 'another'] ) assert_equal(ColumnAligner(18, table)._widths, [18, 10, 12, 7])
def test_names_on_first_content_row(self): table = TestCaseTable(None) t = table.add('Test') t.add_step(['No op']) extractor = DataExtractor(lambda t,n: True) assert_equal(list(extractor._rows_from_indented_table(table)), [['Test', 'No op']])
def test_counting_column_widths(self): table = TestCaseTable(None) table.set_header(['test cases', 'col header', 'short']) assert_equals(ColumnAligner(18, table)._widths, [18, 10, 5]) test = table.add('A test') test.add_step(['Some kw', 'a longer arg', 'another']) assert_equals(ColumnAligner(18, table)._widths, [18, 10, 12, 7])
def test_counting_column_widths(self): table = TestCaseTable(None) table.set_header(["test cases", "col header", "short"]) assert_equals(ColumnAligner(18, table)._widths, [18, 10, 5]) test = table.add("A test") test.add_step(["Some kw", "a longer arg", "another"]) assert_equals(ColumnAligner(18, table)._widths, [18, 10, 12, 7])
def create_test_case_file(): data = TestCaseFile(source='foo.txt') table = TestCaseTable(data) data.testcase_table = table table.set_header(['test case', 'some', 'and other']) test = table.add('A test') test.add_step(['A kw', 'an arg']) return data
def create_test_case_file(): data = TestCaseFile(source="foo.txt") table = TestCaseTable(data) data.testcase_table = table table.set_header(["test case", "some", "and other"]) test = table.add("A test") test.add_step(["A kw", "an arg"]) return data
import unittest from robot.parsing.model import VariableTable, TestCaseTable from robot.utils.asserts import assert_equals from robot.writer.dataextractor import DataExtractor var_table = VariableTable(None) var_table.add('${A scalar}', 'value', 'var comment') var_table.add('', '', 'standalone comment') var_table.add('@{A list}', ['v', 'a', 'lue']) var_table_rows = [['${A scalar}', 'value', '# var comment'], ['# standalone comment'], ['@{A list}', 'v', 'a', 'lue']] test_table = TestCaseTable(None) test = test_table.add('A test case') test.add_step(['No Operation']) test.add_step(['Log Many', 'bar', 'quux', '#comment']) loop = test.add_for_loop(['${i}', 'IN RANGE', '10']) loop.add_step(['Log', '${i}']) test2 = test_table.add('Second test') test2.add_step(['FAIL']) test_table_rows = [['A test case'], ['', 'No Operation'], ['', 'Log Many', 'bar', 'quux', '#comment'], ['', ': FOR', '${i}', 'IN RANGE', '10'], ['', '', 'Log', '${i}'], [], ['Second test'], ['', 'FAIL'], []] class DataExtractorTest(unittest.TestCase):
from robot.parsing.model import VariableTable, TestCaseTable from robot.utils.asserts import assert_equal from robot.writer.dataextractor import DataExtractor var_table = VariableTable(None) var_table.add('${A scalar}', 'value', 'var comment') var_table.add('', '', 'standalone comment') var_table.add('@{A list}', ['v', 'a', 'lue']) var_table_rows = [['${A scalar}', 'value', '# var comment'], ['# standalone comment'], ['@{A list}', 'v', 'a', 'lue']] test_table = TestCaseTable(None) test = test_table.add('A test case') test.add_step(['No Operation']) test.add_step(['Log Many', 'bar', 'quux', '#comment']) loop = test.add_for_loop(['${i}', 'IN RANGE', '10']) loop.add_step(['Log', '${i}']) test2 = test_table.add('Second test') test2.add_step(['FAIL']) test_table_rows = [['A test case'], ['', 'No Operation'], ['', 'Log Many', 'bar', 'quux', '#comment'], ['', 'FOR', '${i}', 'IN RANGE', '10'], ['', '', 'Log', '${i}'], ['', 'END'], [], ['Second test'],
def test_aligned_header_cells_are_not_escaped(self): table = TestCaseTable(None) table.set_header(['test case', 'cus tom', 'header']) table.add('Test case with a long name').add_step(['keyword here', 'args']) assert_equal(self._formatter.format_header(table), ['*** test case *** ', 'cus \\ tom ', 'header'])