robotframework-2.7.7.utest.writer.test_rowsplitter.py Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of robotframework Show documentation
Show all versions of robotframework Show documentation
High level test automation framework
The newest version!
import unittest
from robot.writer.rowsplitter import RowSplitter
from robot.utils.asserts import assert_equals
class TestRowSplitter(unittest.TestCase):
def setUp(self):
self._cols = 3
self._formatter = RowSplitter(cols=self._cols)
def _split(self, data):
return list(self._formatter.split(data, 'whatever'))
def test_escaping_empty_cells_at_eol(self):
assert_equals(self._split(['Some', 'text', '', 'with empty']),
[['Some', 'text', '${EMPTY}'],
['...', 'with empty']])
def test_splitting_inside_comment(self):
assert_equals(self._split(['Kw', 'Arg', '#Comment in', 'many cells']),
[['Kw', 'Arg', '#Comment in'], ['...', '#many cells']])
def test_splitting_whitespace_rows(self):
# Checking loop border case conditions in row splitting mechanism
# Based on
assert_equals(self._split(['']*(self._cols+1)+['foo', '#Some random comment']),
[['', '', '${EMPTY}'],
['...', '', 'foo'],
['...', '#Some random comment']])
assert_equals(self._split(['']*self._cols+['foo', '#Some random comment']),
[['', '', '${EMPTY}'],
['...', 'foo', '#Some random comment']])
assert_equals(self._split(['']*(self._cols-1)+['foo', '#Some random comment']),
[['', '', 'foo'],
['...', '#Some random comment']])