Revision: ff0c290610a8
Branch:   default
Author:   Pekka Klärck
Date:     Wed Sep 12 04:24:00 2012
Log: BuiltIn: log argument type of u'foo' as unicode with IronPython even when it actually is str there
http://code.google.com/p/robotframework/source/detail?r=ff0c290610a8

Modified:
 /src/robot/libraries/BuiltIn.py

=======================================
--- /src/robot/libraries/BuiltIn.py     Wed Sep  5 04:41:56 2012
+++ /src/robot/libraries/BuiltIn.py     Wed Sep 12 04:24:00 2012
@@ -405,9 +405,15 @@
                                   self._include_values(values))

     def _log_types(self, *args):
-        msg = ["Argument types are:"] + [str(type(a)) for a in args]
+        msg = ["Argument types are:"] + [self._get_type(a) for a in args]
         self.log('\n'.join(msg))

+    def _get_type(self, arg):
+ # In IronPython type(u'x') is str. We want to report unicode anyway.
+        if isinstance(arg, unicode):
+            return "<type 'unicode'>"
+        return str(type(arg))
+
     def _include_values(self, values):
         if isinstance(values, basestring):
             return values.lower() not in ['no values', 'false']

Reply via email to