Revision: 3850
Author: janne.t.harkonen
Date: Thu Aug 19 03:09:58 2010
Log: clenup, handle tc/uk settings differently
http://code.google.com/p/robotframework/source/detail?r=3850

Modified:
 /trunk/src/robot/parsing/datarow.py
 /trunk/src/robot/parsing/tablepopulators.py
 /trunk/utest/parsing/test_populator.py

=======================================
--- /trunk/src/robot/parsing/datarow.py Wed Aug 18 23:52:44 2010
+++ /trunk/src/robot/parsing/datarow.py Thu Aug 19 03:09:58 2010
@@ -62,8 +62,6 @@
         if self.is_continuing():
             index = self.cells.index(self._row_continuation_marker) + 1
             return self.cells[index:]
-        if self.starts_test_or_user_keyword_setting():
-            return self.cells[1:]
         return self.cells

     def dedent(self):
@@ -94,6 +92,9 @@
         head = self.head
         return head and head[0] == '[' and head[-1] == ']'

+    def test_or_user_keyword_setting_name(self):
+        return self.head[1:-1].strip()
+
     def is_indented(self):
         return self.head == ''

@@ -107,8 +108,5 @@
     def is_commented(self):
         return bool(not self.cells and self.comments)

-    def test_or_user_keyword_setting_name(self):
-        return self.head[1:-1].strip()
-
     def __nonzero__(self):
         return bool(self.cells or self.comments)
=======================================
--- /trunk/src/robot/parsing/tablepopulators.py Wed Aug 18 23:52:44 2010
+++ /trunk/src/robot/parsing/tablepopulators.py Thu Aug 19 03:09:58 2010
@@ -51,10 +51,7 @@
             self._populator.populate()
             self._populator = self._get_populator(row)
         self._comments.consume_comments_with(self._populator.add)
- if isinstance(self._populator, (SettingPopulator, VariablePopulator)):
-            self._populator.add(row.dedent())
-        else:
-            self._populator.add(row)
+        self._populator.add(row)

     def populate(self):
         self._comments.consume_comments_with(self._populator.add)
@@ -224,6 +221,9 @@
             self._add(row)
         self._comments.add(row)

+    def _add(self, row):
+        self._value.extend(row.dedent().data)
+

 class VariablePopulator(_PropertyPopulator):

@@ -231,9 +231,6 @@
         _PropertyPopulator.__init__(self, setter)
         self._name = name

-    def _add(self, row):
-        self._value.extend(row.data)
-
     def populate(self):
         self._setter(self._name, self._value,
                      self._comments.formatted_value())
@@ -241,9 +238,6 @@

 class SettingPopulator(_PropertyPopulator):

-    def _add(self, row):
-        self._value.extend(row.data)
-
     def populate(self):
         self._setter(self._value, self._comments.formatted_value())

=======================================
--- /trunk/utest/parsing/test_populator.py      Wed Aug 18 23:52:36 2010
+++ /trunk/utest/parsing/test_populator.py      Thu Aug 19 03:09:58 2010
@@ -219,10 +219,12 @@

     def test_adding_variables(self):
         self._create_table('Variables', [['${scalar}', 'value'],
+                                         ['${slist}', '[s, o, m, e]'],
['@{list}', 'v1', 'v2', 'v3', 'v4']])
-        assert_equals(len(self._datafile.variable_table.variables), 2)
+        assert_equals(len(self._datafile.variable_table.variables), 3)
         self._assert_variable(0, '${scalar}', ['value'])
-        self._assert_variable(1, '@{list}', ['v1', 'v2', 'v3', 'v4'])
+        self._assert_variable(1, '${slist}', ['[s, o, m, e]'])
+        self._assert_variable(2, '@{list}', ['v1', 'v2', 'v3', 'v4'])

     def test_line_continuation_in_variable_table(self):
         self._create_table('Variables', [['@{list}'],

Reply via email to