Revision: 6dc5d8b2a202
Branch: default
Author: Pekka Klärck
Date: Tue Oct 23 14:37:32 2012
Log: parsing: refactored tsv/txt readers a little
http://code.google.com/p/robotframework/source/detail?r=6dc5d8b2a202
Modified:
/doc/userguide/src/CreatingTestData/TestDataSyntax.rst
/src/robot/parsing/tsvreader.py
/src/robot/parsing/txtreader.py
=======================================
--- /doc/userguide/src/CreatingTestData/TestDataSyntax.rst Mon Oct 15
03:52:11 2012
+++ /doc/userguide/src/CreatingTestData/TestDataSyntax.rst Tue Oct 23
14:37:32 2012
@@ -496,7 +496,8 @@
'''''''''''''''''''
Robot Framework handles whitespace, such as spaces, newlines and tabs,
-the same way as they are handled in HTML. This means that Robot Framework:
+the same way as they are handled in HTML. This means that
+Robot Framework:
- Removes leading and trailing whitespace in all cells.
- Changes multiple consecutive spaces into single spaces.
=======================================
--- /src/robot/parsing/tsvreader.py Tue Oct 23 13:01:36 2012
+++ /src/robot/parsing/tsvreader.py Tue Oct 23 14:37:32 2012
@@ -39,11 +39,11 @@
row = row.decode('UTF-8')
if NBSP in row:
row = row.replace(NBSP, ' ')
- return row
+ return row.rstrip()
@classmethod
def split_row(cls, row):
- return row.rstrip().split('\t')
+ return row.split('\t')
def _process(self, cell):
if len(cell) > 1 and cell[0] == cell[-1] == '"':
=======================================
--- /src/robot/parsing/txtreader.py Tue Oct 23 13:01:36 2012
+++ /src/robot/parsing/txtreader.py Tue Oct 23 14:37:32 2012
@@ -14,7 +14,7 @@
import re
-from tsvreader import TsvReader
+from .tsvreader import TsvReader
class TxtReader(TsvReader):
@@ -23,7 +23,8 @@
@classmethod
def split_row(cls, row):
- row = row.rstrip().replace('\t', ' ')
+ if '\t' in row:
+ row = row.replace('\t', ' ')
if not row.startswith('| '):
return cls._space_splitter.split(row)
row = row[1:-1] if row.endswith(' |') else row[1:]