Revision: 3413
Author: jprantan
Date: Mon May 24 04:48:47 2010
Log: Added is_comment and changed empty kw to be None instead of ''.
http://code.google.com/p/robotframework/source/detail?r=3413
Modified:
/trunk/src/robot/parsing/model.py
/trunk/utest/parsing/test_model.py
=======================================
--- /trunk/src/robot/parsing/model.py Mon May 24 02:27:53 2010
+++ /trunk/src/robot/parsing/model.py Mon May 24 04:48:47 2010
@@ -378,7 +378,7 @@
try:
self.keyword = content[len(self.assign)]
except IndexError:
- self.keyword = ''
+ self.keyword = None
self.args = content[len(self.assign)+1:]
self.comment = comment
@@ -390,3 +390,6 @@
break
vars.append(item)
return vars
+
+ def is_comment(self):
+ return not self.assign and not self.keyword and not self.args
=======================================
--- /trunk/utest/parsing/test_model.py Mon May 24 02:27:53 2010
+++ /trunk/utest/parsing/test_model.py Mon May 24 04:48:47 2010
@@ -260,7 +260,11 @@
self._test(['${v1}=', '${v2}=', 'KW'], assign=['${v1}', '${v2}'])
def test_assign_without_keyword(self):
- self._test(['${v1}', '${v2}'], kw='', assign=['${v1}', '${v2}'])
+ self._test(['${v1}', '${v2}'], kw=None, assign=['${v1}', '${v2}'])
+
+ def test_is_comment(self):
+ assert_true(Step([], comment="comment").is_comment())
+ assert_false(Step(['KW'], comment="comment").is_comment())
def _test(self, content, kw='KW', args=[], assign=[]):
step = Step(content)