Revision: 3626
Author: jussi.ao.malinen
Date: Fri May 28 03:44:45 2010
Log: removed references to utils.to_list and utils.dict2map
http://code.google.com/p/robotframework/source/detail?r=3626

Modified:
 /trunk/src/robot/common/keyword.py
 /trunk/src/robot/common/model.py
 /trunk/src/robot/common/statistics.py
 /trunk/src/robot/output/listeners.py
 /trunk/src/robot/running/testlibraries.py
 /trunk/src/robot/variables/variables.py
 /trunk/utest/common/test_statistics.py

=======================================
--- /trunk/src/robot/common/keyword.py  Tue Mar 23 04:15:41 2010
+++ /trunk/src/robot/common/keyword.py  Fri May 28 03:44:45 2010
@@ -13,14 +13,11 @@
 #  limitations under the License.


-from robot import utils
-
-
 class BaseKeyword:

     def __init__(self, name='', args=None, doc='', timeout='', type='kw'):
         self.name = name
-        self.args = utils.to_list(args)
+        self.args = args or []
         self.doc = doc
         self.timeout = timeout
         self.type = type
=======================================
--- /trunk/src/robot/common/model.py    Thu May 27 07:11:21 2010
+++ /trunk/src/robot/common/model.py    Fri May 28 03:44:45 2010
@@ -202,8 +202,8 @@
         self.filter_by_tags(includes, excludes)

     def filter_by_names(self, suites=None, tests=None):
- suites = [ ([], name.split('.')) for name in utils.to_list(suites) ]
-        tests = utils.to_list(tests)
+        suites = [ ([], name.split('.')) for name in suites or [] ]
+        tests = tests or []
         if (suites or tests) and not self._filter_by_names(suites, tests):
             self._raise_no_tests_filtered_by_names(suites, tests)

@@ -435,8 +435,8 @@
         self.set(tags, nons)

     def set(self, tags, nons):
-        self.tags = utils.normalize_tags(utils.to_list(tags))
-        self.nons = utils.normalize_tags(utils.to_list(nons))
+        self.tags = utils.normalize_tags(tags or [])
+        self.nons = utils.normalize_tags(nons or [])

     def is_critical(self, tag):
         return utils.matches_any(tag, self.tags)
=======================================
--- /trunk/src/robot/common/statistics.py       Thu May 27 07:11:21 2010
+++ /trunk/src/robot/common/statistics.py       Fri May 28 03:44:45 2010
@@ -181,10 +181,10 @@
     def __init__(self, include=None, exclude=None, tag_stat_combine=None,
                  docs=None, links=None):
         self.stats = utils.NormalizedDict()
-        self._include = utils.to_list(include)
-        self._exclude = utils.to_list(exclude)
+        self._include = include or []
+        self._exclude = exclude or []
self._patterns_and_names = self._get_patterns_and_names(tag_stat_combine) - self._taginfo = TagStatInfo(utils.to_list(docs), utils.to_list(links))
+        self._taginfo = TagStatInfo(docs or [], links or [])

     def _get_patterns_and_names(self, tag_stat_combine_options):
         if not tag_stat_combine_options:
=======================================
--- /trunk/src/robot/output/listeners.py        Thu May 27 11:20:09 2010
+++ /trunk/src/robot/output/listeners.py        Fri May 28 03:44:45 2010
@@ -13,6 +13,7 @@
 #  limitations under the License.

 import inspect
+import sys

 from robot import utils
 from robot.errors import DataError
@@ -21,6 +22,7 @@

 if utils.is_jython:
     from java.lang import Object
+    from java.util import HashMap


 class Listeners:
@@ -198,5 +200,13 @@

     def _convert_possible_dict_to_map(self, arg):
         if isinstance(arg, dict):
-            return utils.dict2map(arg)
+            return self._dict2map(arg)
         return arg
+
+    def _dict2map(self, dictionary):
+        if not utils.is_jython:
+            return dictionary
+        map = HashMap()
+        for key, value in dictionary.items():
+            map.put(key, value)
+        return map
=======================================
--- /trunk/src/robot/running/testlibraries.py   Thu May 27 23:15:11 2010
+++ /trunk/src/robot/running/testlibraries.py   Fri May 28 03:44:45 2010
@@ -31,7 +31,7 @@
 def TestLibrary(name, args=None, variables=None):
     libcode, source = utils.import_(name)
     libclass = _get_lib_class(libcode)
-    return libclass(libcode, source, name, utils.to_list(args), variables)
+    return libclass(libcode, source, name, args or [], variables)


 def _get_lib_class(libcode):
=======================================
--- /trunk/src/robot/variables/variables.py     Thu May 27 11:12:49 2010
+++ /trunk/src/robot/variables/variables.py     Fri May 28 03:44:45 2010
@@ -113,7 +113,7 @@
         Result is always a list.
         """
         results = []
-        for item in utils.to_list(items):
+        for item in items or []:
listvar = self._replace_variables_inside_possible_list_var(item)
             if listvar:
                 results.extend(self[listvar])
@@ -207,7 +207,7 @@

     def set_from_file(self, path, args, overwrite=False):
LOGGER.info("Importing varible file '%s' with args %s" % (path, args))
-        args = utils.to_list(args)
+        args = args or []
         try:
             module = utils.simple_import(path)
             variables = self._get_variables_from_module(module, args)
=======================================
--- /trunk/utest/common/test_statistics.py      Thu May 27 07:11:21 2010
+++ /trunk/utest/common/test_statistics.py      Fri May 28 03:44:45 2010
@@ -35,7 +35,7 @@

     def add_test(self, status, tags=None):
         test = TestMock(status, tags,
-                        self.critical.are_critical(utils.to_list(tags)))
+                        self.critical.are_critical(tags or []))
         self.tests.append(test)
         return test

Reply via email to