3 new revisions:
Revision: f7ac033c75e2
Author: Pekka Klärck
Date: Wed Dec 7 13:04:44 2011
Log: test_jsondatamodel.py -> test_jswriter.py
http://code.google.com/p/robotframework/source/detail?r=f7ac033c75e2
Revision: 9e735a4d78f4
Author: Pekka Klärck
Date: Wed Dec 7 23:39:37 2011
Log: JsExecResult: cleaned up, and added tests, for removing data not
neede...
http://code.google.com/p/robotframework/source/detail?r=9e735a4d78f4
Revision: f369e26946c0
Author: Pekka Klärck
Date: Wed Dec 7 23:39:56 2011
Log: merge
http://code.google.com/p/robotframework/source/detail?r=f369e26946c0
==============================================================================
Revision: f7ac033c75e2
Author: Pekka Klärck
Date: Wed Dec 7 13:04:44 2011
Log: test_jsondatamodel.py -> test_jswriter.py
http://code.google.com/p/robotframework/source/detail?r=f7ac033c75e2
Added:
/utest/reporting/test_jswriter.py
Deleted:
/utest/reporting/test_jsondatamodel.py
=======================================
--- /dev/null
+++ /utest/reporting/test_jswriter.py Wed Dec 7 13:04:44 2011
@@ -0,0 +1,59 @@
+from StringIO import StringIO
+import unittest
+
+from robot.utils.asserts import assert_equals, assert_true
+from robot.reporting.jsexecutionresult import JsExecutionResult
+from robot.reporting.jswriter import ScriptBlockWriter
+
+
+class TestDataModelWrite(unittest.TestCase):
+
+ def test_writing_datamodel_elements(self):
+ lines = self._get_lines()
+ assert_true(lines[0].startswith('window.output = {}'), lines[0])
+ assert_true(lines[1].startswith('window.output["'), lines[1])
+ assert_true(lines[-1].startswith('window.settings ='), lines[-1])
+
+ def _get_lines(self, suite=None, strings=None, basemillis=100,
separator=None,
+ split_threshold=None):
+ output = StringIO()
+ data = JsExecutionResult(suite, None, None, strings, basemillis)
+ ScriptBlockWriter(separator=separator,
split_threshold=split_threshold).write_to(output, data, {})
+ return output.getvalue().splitlines()
+
+ def test_writing_datamodel_with_separator(self):
+ lines = self._get_lines(separator='seppo\n')
+ assert_true(len(lines) >= 2)
+ self._assert_separators_in(lines, 'seppo')
+
+ def _assert_separators_in(self, lines, separator):
+ for index, line in enumerate(lines):
+ if index % 2:
+ assert_equals(line, separator)
+ else:
+ assert_true(line.startswith('window.'))
+
+ def test_writing_datamodel_with_split_threshold_in_suite(self):
+ suite = (1, (2, 3), (4, (5,), (6, 7)), 8)
+ lines = self._get_lines(suite=suite, split_threshold=2,
separator='foo\n')
+ parts = filter(lambda l: l.startswith('window.sPart'), lines)
+ expected = ['window.sPart0 = [2,3];',
+ 'window.sPart1 = [6,7];',
+ 'window.sPart2 = [4,[5],window.sPart1];',
+ 'window.sPart3 = [1,window.sPart0,window.sPart2,8];']
+ assert_equals(parts, expected)
+ self._assert_separators_in(lines, 'foo')
+
+ def test_splitting_output_strings(self):
+ lines = self._get_lines(strings=['data' for _ in range(100)],
+ split_threshold=9, separator='?\n')
+ parts = [l for l in lines if
l.startswith('window.output["strings')]
+ assert_equals(len(parts), 13)
+ assert_equals(parts[0], 'window.output["strings"] = [];')
+ for line in parts[1:]:
+ assert_true(line.startswith('window.output["strings"] =
window.output["strings"].concat(['), line)
+ self._assert_separators_in(lines, '?')
+
+
+if __name__ == '__main__':
+ unittest.main()
=======================================
--- /utest/reporting/test_jsondatamodel.py Wed Dec 7 12:26:00 2011
+++ /dev/null
@@ -1,59 +0,0 @@
-from StringIO import StringIO
-import unittest
-
-from robot.utils.asserts import assert_equals, assert_true
-from robot.reporting.jsexecutionresult import JsExecutionResult
-from robot.reporting.jswriter import ScriptBlockWriter
-
-
-class TestDataModelWrite(unittest.TestCase):
-
- def test_writing_datamodel_elements(self):
- lines = self._get_lines()
- assert_true(lines[0].startswith('window.output = {}'), lines[0])
- assert_true(lines[1].startswith('window.output["'), lines[1])
- assert_true(lines[-1].startswith('window.settings ='), lines[-1])
-
- def _get_lines(self, suite=None, strings=None, basemillis=100,
separator=None,
- split_threshold=None):
- output = StringIO()
- data = JsExecutionResult(suite, None, None, strings, basemillis)
- ScriptBlockWriter(separator=separator,
split_threshold=split_threshold).write_to(output, data, {})
- return output.getvalue().splitlines()
-
- def test_writing_datamodel_with_separator(self):
- lines = self._get_lines(separator='seppo\n')
- assert_true(len(lines) >= 2)
- self._assert_separators_in(lines, 'seppo')
-
- def _assert_separators_in(self, lines, separator):
- for index, line in enumerate(lines):
- if index % 2:
- assert_equals(line, separator)
- else:
- assert_true(line.startswith('window.'))
-
- def test_writing_datamodel_with_split_threshold_in_suite(self):
- suite = (1, (2, 3), (4, (5,), (6, 7)), 8)
- lines = self._get_lines(suite=suite, split_threshold=2,
separator='foo\n')
- parts = filter(lambda l: l.startswith('window.sPart'), lines)
- expected = ['window.sPart0 = [2,3];',
- 'window.sPart1 = [6,7];',
- 'window.sPart2 = [4,[5],window.sPart1];',
- 'window.sPart3 = [1,window.sPart0,window.sPart2,8];']
- assert_equals(parts, expected)
- self._assert_separators_in(lines, 'foo')
-
- def test_splitting_output_strings(self):
- lines = self._get_lines(strings=['data' for _ in range(100)],
- split_threshold=9, separator='?\n')
- parts = [l for l in lines if
l.startswith('window.output["strings')]
- assert_equals(len(parts), 13)
- assert_equals(parts[0], 'window.output["strings"] = [];')
- for line in parts[1:]:
- assert_true(line.startswith('window.output["strings"] =
window.output["strings"].concat(['), line)
- self._assert_separators_in(lines, '?')
-
-
-if __name__ == '__main__':
- unittest.main()
==============================================================================
Revision: 9e735a4d78f4
Author: Pekka Klärck
Date: Wed Dec 7 23:39:37 2011
Log: JsExecResult: cleaned up, and added tests, for removing data not
needed in reports
http://code.google.com/p/robotframework/source/detail?r=9e735a4d78f4
Added:
/utest/reporting/test_jsexecutionresult.py
Modified:
/src/robot/reporting/jsexecutionresult.py
=======================================
--- /dev/null
+++ /utest/reporting/test_jsexecutionresult.py Wed Dec 7 23:39:37 2011
@@ -0,0 +1,92 @@
+import unittest
+
+from robot.utils.asserts import assert_true, assert_equals
+from test_jsmodelbuilders import remap
+from robot.reporting.jsexecutionresult import (JsExecutionResult,
+ _KeywordRemover,
StringIndex)
+from robot.reporting.jsmodelbuilders import SuiteBuilder, JsBuildingContext
+from robot.result import TestSuite
+
+
+class TestRemoveDataNotNeededInReport(unittest.TestCase):
+
+ def test_remove_keywords(self):
+ model = self._create_suite_model()
+ expected = self._get_expected_suite_model(model)
+ result = _KeywordRemover().remove_keywords(model)
+ assert_equals(result, expected)
+ self._verify_model_contains_no_keywords(result)
+
+ def _create_suite_model(self):
+ self.context = JsBuildingContext()
+ return SuiteBuilder(self.context).build(self._get_suite())
+
+ def _get_suite(self):
+ suite = TestSuite(name='root', doc='sdoc', metadata={'m': 'v'})
+ suite.keywords.create(name='keyword')
+ sub = suite.suites.create(name='suite',
metadata={'a': '1', 'b': '2'})
+ sub.keywords.create(name='keyword')
+ t1 = sub.tests.create(name='test', tags=['t1'])
+ t1.keywords.create(name='keyword')
+ t1.keywords.create(name='keyword')
+ t2 = sub.tests.create(name='test', tags=['t1', 't2'])
+ t2.keywords.create(name='keyword')
+ return suite
+
+ def _get_expected_suite_model(self, suite):
+ suite = list(suite)
+ suite[-4] = tuple(self._get_expected_suite_model(s) for s in
suite[-4])
+ suite[-3] = tuple(self._get_expected_test_model(t) for t in
suite[-3])
+ suite[-2] = ()
+ return tuple(suite)
+
+ def _get_expected_test_model(self, test):
+ test = list(test)
+ test[-1] = ()
+ return tuple(test)
+
+ def _verify_model_contains_no_keywords(self, model, mapped=False):
+ if not mapped:
+ model = remap(model, self.context.strings)
+ assert_true('keyword' not in model, 'Not all keywords removed')
+ for item in model:
+ if isinstance(item, tuple):
+ self._verify_model_contains_no_keywords(item, mapped=True)
+
+ def test_remove_unused_strings(self):
+ strings = ('', 'hei', 'hoi')
+ model = (1, StringIndex(0), 42, StringIndex(2), -1, None)
+ model, strings = _KeywordRemover().remove_unused_strings(model,
strings)
+ assert_equals(strings, ('', 'hoi'))
+ assert_equals(model, (1, 0, 42, 1, -1, None))
+
+ def test_remove_unused_strings_nested(self):
+ strings = tuple(' abcde')
+ model = (StringIndex(0), StringIndex(1), 2, 3, StringIndex(4), 5,
+ (0, StringIndex(1), 2, StringIndex(3), 4, 5))
+ model, strings = _KeywordRemover().remove_unused_strings(model,
strings)
+ assert_equals(strings, tuple(' acd'))
+ assert_equals(model, (0, 1, 2, 3, 3, 5, (0, 1, 2, 2, 4, 5)))
+
+ def test_through_jsexecutionresult(self):
+ suite = (0, StringIndex(1), 2, 3, 4, StringIndex(5),
+ ((0, 1, 2, StringIndex(3), 4, 5, (), (),
('suite', 'kws'), 9),),
+ ((0, 1, 2, StringIndex(3), 4, 5, ('test', 'kws')),
+ (0, StringIndex(1), 2, 3, 4, 5, ('test', 'kws'))),
+ ('suite', 'kws'), 9)
+ exp_s = (0, 0, 2, 3, 4, 2,
+ ((0, 1, 2, 1, 4, 5, (), (), (), 9),),
+ ((0, 1, 2, 1, 4, 5, ()),
+ (0, 0, 2, 3, 4, 5, ())),
+ (), 9)
+ result = JsExecutionResult(suite=suite, strings=tuple(' ABCDEF'),
+ errors=(1, 2), statistics={},
basemillis=0)
+ assert_equals(result.data['errors'], (1, 2))
+ result.remove_data_not_needed_in_report()
+ assert_equals(result.strings, tuple('ACE'))
+ assert_equals(result.suite, exp_s)
+ assert_true('errors' not in result.data)
+
+
+if __name__ == '__main__':
+ unittest.main()
=======================================
--- /src/robot/reporting/jsexecutionresult.py Wed Dec 7 12:30:34 2011
+++ /src/robot/reporting/jsexecutionresult.py Wed Dec 7 23:39:37 2011
@@ -40,51 +40,57 @@
def remove_data_not_needed_in_report(self):
self.data.pop('errors')
-
- # TODO: All code below needs to be moved into separate object and
unit tested
- self.suite = tuple(self._remove_keywords_from_suite(self.suite))
- self._remove_unused_strings()
+ remover = _KeywordRemover()
+ self.suite = remover.remove_keywords(self.suite)
+ self.suite, self.strings \
+ = remover.remove_unused_strings(self.suite, self.strings)
+
+
+class _KeywordRemover(object):
+
+ def remove_keywords(self, suite):
+ return self._remove_keywords_from_suite(suite)
def _remove_keywords_from_suite(self, suite):
- for index, item in enumerate(suite):
- if index == 6:
- yield tuple(tuple(self._remove_keywords_from_suite(s)) for
s in item)
- elif index == 7:
- yield tuple(tuple(self._remove_keywords_from_test(t)) for
t in item)
- elif index == 8:
- yield ()
- else:
- yield item
+ return suite[:6] + (self._remove_keywords_from_suites(suite[6]),
+ self._remove_keywords_from_tests(suite[7]),
+ (), suite[9])
+
+ def _remove_keywords_from_suites(self, suites):
+ return tuple(self._remove_keywords_from_suite(s) for s in suites)
+
+ def _remove_keywords_from_tests(self, tests):
+ return tuple(self._remove_keywords_from_test(t) for t in tests)
def _remove_keywords_from_test(self, test):
- for index, item in enumerate(test):
- yield item if index != 6 else ()
-
- def _remove_unused_strings(self):
- used = self._collect_used_indices(self.suite, set())
+ return test[:-1] + ((),) # TODO: Could we just return test[:-1]?
+
+ def remove_unused_strings(self, model, strings):
+ used = set(self._get_used_indices(model))
remap = {}
- self.strings = tuple(self._get_used_strings(self.strings, used,
remap))
- self.suite = tuple(self._remap_string_indices(self.suite, remap))
-
- def _collect_used_indices(self, data, result):
- for item in data:
+ strings = tuple(self._get_used_strings(strings, used, remap))
+ model = tuple(self._remap_string_indices(model, remap))
+ return model, strings
+
+ def _get_used_indices(self, model):
+ for item in model:
if isinstance(item, StringIndex):
- result.add(item)
+ yield item
elif isinstance(item, tuple):
- self._collect_used_indices(item, result)
- return result
-
- def _get_used_strings(self, data, used, index_remap):
+ for i in self._get_used_indices(item):
+ yield i
+
+ def _get_used_strings(self, strings, used_indices, remap):
offset = 0
- for index, text in enumerate(data):
- if index in used:
- index_remap[index] = index - offset
- yield text
+ for index, string in enumerate(strings):
+ if index in used_indices:
+ remap[index] = index - offset
+ yield string
else:
offset += 1
- def _remap_string_indices(self, data, remap):
- for item in data:
+ def _remap_string_indices(self, model, remap):
+ for item in model:
if isinstance(item, StringIndex):
yield remap[item]
elif isinstance(item, tuple):
==============================================================================
Revision: f369e26946c0
Author: Pekka Klärck
Date: Wed Dec 7 23:39:56 2011
Log: merge
http://code.google.com/p/robotframework/source/detail?r=f369e26946c0
Deleted:
/src/robot/writer/tablewriter.py
/utest/writer/test_htmlfilewriter.py
/utest/writer/test_tablewriter.py
=======================================
--- /src/robot/writer/tablewriter.py Fri Dec 2 03:50:53 2011
+++ /dev/null
@@ -1,152 +0,0 @@
-# Copyright 2008-2011 Nokia Siemens Networks Oyj
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-class TableWriter(object):
-
- def __init__(self, output, separator):
- self._output = output
- self._separator = separator
- self._has_headers = False
-
- def add_headers(self, headers):
- self._col_writer = ColumnWriter(self._output, headers,
self._separator)
-
- def add_tcuk_name(self, name):
- self._col_writer.add_tcuk_name(name)
-
- def add_row(self, row):
- self._col_writer.add_row(row)
-
- def write(self):
- self._col_writer.write()
-
-
-def SpaceSeparator(line_separator='\n',
- number_of_spaces=4):
- return _Separator(' '*number_of_spaces,
- line_separator,
- align_separator=' ')
-
-def PipeSeparator(line_separator='\n'):
- return _Separator(' | ',
- line_separator,
- line_prefix='| ',
- line_postfix=' |',
- align_separator=' | ')
-
-
-def ColumnWriter(output, headers, separator):
- if headers[1:]:
- return _AlignedColumnWriter(output, headers, separator)
- else:
- return _FixedColumnWriter(output, headers, separator)
-
-
-class _Separator(object):
-
- def __init__(self,
- cell_separator,
- line_separator,
- line_prefix='',
- line_postfix='',
- align_separator=''):
- self.cell_separator = cell_separator
- self.line_separator = line_separator
- self.line_prefix = line_prefix
- self.line_postfix = line_postfix
- self.align_separator=align_separator
-
-class _TableColumnWriter(object):
-
- def __init__(self,
- output,
- headers,
- separator):
- self._output = output
- self._separator = separator
- self._headers = headers
- self._data = []
-
- def add_row(self, row):
- self._data += [row]
-
- def write(self):
- for row in [self._headers]+self._data:
- self._write_row(row, self._separator.cell_separator)
-
- def add_tcuk_name(self, name):
- self.add_row([name])
-
-
-class _FixedColumnWriter(_TableColumnWriter):
-
- def _write_row(self, row, col_separator):
- if row:
- if '|' in self._separator.cell_separator and not row[0]:
- row = row[:]
- row[0] = ' '
- self._output.write(self._separator.line_prefix)
- self._output.write(col_separator.join(row))
- self._output.write(self._separator.line_postfix)
- self._output.write(self._separator.line_separator)
-
-
-class _AlignedColumnWriter(_TableColumnWriter):
-
- _tcuk_name_in_cache = None
-
- def _write_row(self, row, col_separator):
- if row:
- self._output.write(self._separator.line_prefix)
- for column, value in enumerate(row[:-1]):
-
self._output.write(value.ljust(self._get_column_justifications(column)))
- self._output.write(self._separator.align_separator)
- self._output.write(row[-1])
- self._output.write(self._separator.line_postfix)
- self._output.write(self._separator.line_separator)
-
- def _get_column_justifications(self, col):
- result = 0
- for row in [self._headers]+self._data:
- if len(row) <= max(col, 1):
- continue
- result = max(len(row[col]), result)
- return result
-
- def add_tcuk_name(self, name):
- if self._tcuk_name_in_cache:
- self.add_row([])
- self._tcuk_name_in_cache = name
-
- def add_row(self, row):
- if self._tcuk_name_in_cache:
- self._add_name_row(row)
- else:
- self._data += [row]
-
- def write(self):
- if self._tcuk_name_in_cache:
- self.add_row([])
- _TableColumnWriter.write(self)
- self._output.write(self._separator.line_separator)
-
- def _add_name_row(self, row):
- name = self._tcuk_name_in_cache
- self._tcuk_name_in_cache = None
- if len(name) > 24:
- self.add_row([name])
- self.add_row(row)
- else:
- self.add_row([name]+row[1:])
=======================================
--- /utest/writer/test_htmlfilewriter.py Sat Oct 22 23:54:02 2011
+++ /dev/null
@@ -1,36 +0,0 @@
-import unittest
-from StringIO import StringIO
-
-from robot.utils.asserts import assert_equals
-from robot.writer.serializer import SerializationContext
-from robot.writer.writer import HtmlFileWriter
-
-
-class TestHtmlFileWriter(unittest.TestCase):
-
- def setUp(self):
- context = SerializationContext(FakeDataFile(), output=StringIO())
- self._writer = HtmlFileWriter(context)
-
- def test_add_br_to_newlines(self):
- original = """This is real new line:
- here we have a single backslash n: \\n and here backslash +
newline: \\\n and here bslash blash n \\\\n and bslash x 3 n \\\\\\n """
- expected = 'This is real new line:\n here we have a single
backslash n: \\n<br>\nand here backslash + newline: \\\n and here bslash
blash n \\\\n and bslash x 3 n \\\\\\n<br>\n'
- assert_equals(self._writer._add_br_to_newlines(original), expected)
-
- def test_no_br_to_newlines_without_whitespace(self):
- original = r"Here there is no space after backslash-n: '\n'"
- assert_equals(self._writer._add_br_to_newlines(original), original)
-
- def test_no_br_to_double_backslashes(self):
- original = r"Here there is double backslash-n: \\n "
- assert_equals(self._writer._add_br_to_newlines(original), original)
-
-
-class FakeDataFile(object):
- name = 'some name'
- source = 'somefile.html'
-
-
-if __name__ == "__main__":
- unittest.main()
=======================================
--- /utest/writer/test_tablewriter.py Fri Dec 2 03:50:53 2011
+++ /dev/null
@@ -1,145 +0,0 @@
-import unittest
-from robot.writer.tablewriter import TableWriter, SpaceSeparator,
PipeSeparator
-
-
-class _Output(object):
-
- def __init__(self):
- self._data = ''
-
- def should_equal(self, *expected):
- joined = '\n'.join(expected)
- if joined.strip()!=self._data.strip():
- msg = "\n%s \n---\n!=\n---\n%s" %
(repr(joined),repr(self._data))
- raise AssertionError(msg)
-
- def write(self, data):
- self._data += data
-
-
-class TestTableWriter(unittest.TestCase):
-
- def setUp(self):
- self._space_output = _Output()
- self._pipe_output = _Output()
- self._space_writer = TableWriter(output=self._space_output,
- separator=SpaceSeparator())
- self._pipe_writer = TableWriter(output=self._pipe_output,
- separator=PipeSeparator())
-
- def test_writing_test_case(self):
- self._add_headers(['*** Test Cases ***'])
- self._add_tcuk_name('My Test Case')
- self._add_rows([['','Log','Hello'],['','No Operation']])
- self._write()
- self._space_output.should_equal(
- '*** Test Cases ***',
- 'My Test Case',
- ' Log Hello',
- ' No Operation')
- self._pipe_output.should_equal(
- '| *** Test Cases *** |',
- '| My Test Case |',
- '| | Log | Hello |',
- '| | No Operation |')
-
- def _add_headers(self, headers):
- self._pipe_writer.add_headers(headers)
- self._space_writer.add_headers(headers)
-
- def _add_tcuk_name(self, name):
- self._pipe_writer.add_tcuk_name(name)
- self._space_writer.add_tcuk_name(name)
-
- def _add_rows(self, rows):
- for row in rows:
- self._pipe_writer.add_row(row)
- self._space_writer.add_row(row)
-
- def _write(self):
- self._pipe_writer.write()
- self._space_writer.write()
-
- def test_writing_test_case_with_headers(self):
- self._add_headers(['*** Test Cases ***', 'Foo'])
- self._add_tcuk_name('My Test Case')
- self._add_rows([['','Log','Hello'],['','No Operation']])
- self._write()
- self._space_output.should_equal(
- '*** Test Cases *** Foo',
- 'My Test Case Log Hello',
- ' No Operation')
- self._pipe_output.should_equal(
- '| *** Test Cases *** | Foo |',
- '| My Test Case | Log | Hello |',
- '| | No Operation |')
-
- def test_empty_test_cases(self):
- self._add_headers(['*** Test Cases ***'])
- self._add_tcuk_name('My Test Case')
- self._add_tcuk_name('My Test Case2')
- self._write()
- self._space_output.should_equal(
- '*** Test Cases ***',
- 'My Test Case',
- 'My Test Case2')
- self._pipe_output.should_equal(
- '| *** Test Cases *** |',
- '| My Test Case |',
- '| My Test Case2 |')
-
- def test_empty_test_cases_with_headers(self):
- self._add_headers(['*** Test Cases ***', 'foo'])
- self._add_tcuk_name('My Test Case')
- self._add_tcuk_name('My Test Case2')
- self._write()
- self._space_output.should_equal(
- '*** Test Cases *** foo',
- 'My Test Case',
- 'My Test Case2')
- self._pipe_output.should_equal(
- '| *** Test Cases *** | foo |',
- '| My Test Case |',
- '| My Test Case2 |')
-
- def test_inline_name_lengths(self):
- self._add_headers(['*** Test Cases ***', 'Foo'])
- self._add_tcuk_name('Test Case With Length 24')
- self._add_rows([['','Log','Hello'],['','No Operation']])
- self._add_tcuk_name('Test Case With Length 25!')
- self._add_rows([['','Log','Hello'],['','No Operation']])
- self._write()
- self._space_output.should_equal(
- '*** Test Cases *** Foo',
- 'Test Case With Length 24 Log Hello',
- ' No Operation',
- 'Test Case With Length 25!',
- ' Log Hello',
- ' No Operation')
-
- def test_writing_with_2_additional_headers(self):
- self._add_headers(['*** Test Cases ***', 'h1', 'h2'])
- self._add_tcuk_name('My Test')
- self._add_rows([['','Something', 'nothing more to say'],
- ['','Something else', 'jeps', 'heps']])
- self._write()
- self._space_output.should_equal(
- '*** Test Cases *** h1 h2',
- 'My Test Something nothing more to say',
- ' Something else jeps heps'
- )
-
- def test_ignore_first_column_length_when_only_one_element_in_row(self):
- self._add_headers(['*** Test Cases ***', 'h1', 'h2'])
- self._add_tcuk_name('Test Case with very long title that should be
ignored')
- self._add_rows([['', 'something', 'something else']])
- self._write()
- self._space_output.should_equal(
- '*** Test Cases *** h1 h2',
- 'Test Case with very long title that should be ignored',
- ' something something else'
- )
-
-
-if __name__ == '__main__':
- unittest.main()