Revision: 0805feaa9617
Branch:   default
Author:   Pekka Klärck
Date:     Tue Sep 11 23:55:12 2012
Log: variableassigner.py: Changed error message when trying to assing string to a list variable or multiple scalars. Now we report the type of the returned value as 'string' regardless is it actually 'unicode' or 'str'. This ought to fix few tests with IronPython.
http://code.google.com/p/robotframework/source/detail?r=0805feaa9617

Modified:
 /atest/testdata/keywords/return_values.txt
 /atest/testdata/running/for.txt
 /atest/testdata/standard_libraries/builtin/run_keyword_with_errors.txt
 /src/robot/variables/variableassigner.py

=======================================
--- /atest/testdata/keywords/return_values.txt  Wed Sep 28 22:44:06 2011
+++ /atest/testdata/keywords/return_values.txt  Tue Sep 11 23:55:12 2012
@@ -99,7 +99,7 @@
     ${a}  ${b}  ${c} =  Create List  a  b

 Multiple Scalars When No List Returned
- [Documentation] FAIL Cannot assign return values: Expected list-like object, got unicode instead. + [Documentation] FAIL Cannot assign return values: Expected list-like object, got string instead.
     ${a}  ${b} =  Set Variable  This is not list

 List When No List Returned
=======================================
--- /atest/testdata/running/for.txt     Wed Jun 13 03:45:27 2012
+++ /atest/testdata/running/for.txt     Tue Sep 11 23:55:12 2012
@@ -189,7 +189,7 @@
     \  Log  ${nonexisting}

 For With Invalid Set
- [Documentation] FAIL Cannot assign return values: Expected list-like object, got unicode instead. + [Documentation] FAIL Cannot assign return values: Expected list-like object, got string instead.
     :FOR  ${i}  IN  1  3
     \  ${x}  ${y} =  Set Variable  Only one value

=======================================
--- /atest/testdata/standard_libraries/builtin/run_keyword_with_errors.txt Thu May 27 22:58:15 2010 +++ /atest/testdata/standard_libraries/builtin/run_keyword_with_errors.txt Tue Sep 11 23:55:12 2012
@@ -60,15 +60,13 @@
Run Keyword And Ignore Error No Operation wrong number of arguments

 Ignore Error When Syntax Error In Setting Variables
- [Documentation] FAIL Cannot assign return values: Expected list-like object, got unicode instead. + [Documentation] FAIL Cannot assign return values: Expected list-like object, got string instead.
     Run Keyword And Ignore Error  Invalid Syntax When Setting Variable

-
 Ignore Error When Syntax Error In For Loop
     [Documentation]  FAIL  Non-existing variable '\${nonex}'.
     Run Keyword And Ignore Error  For Loop With Syntax Error

-
 Expect Error When Error Occurs
Run Keyword And Expect Error ${ERROR MESSAGE} ${FAIL KW} ${ERROR MESSAGE}

@@ -129,7 +127,7 @@
     Run Keyword And Expect Error  *  Non existing keyword

 Expect Error When Syntax Error In Setting Variables
- [Documentation] FAIL Cannot assign return values: Expected list-like object, got unicode instead. + [Documentation] FAIL Cannot assign return values: Expected list-like object, got string instead.
     Run Keyword And Expect Error  *  Invalid Syntax When Setting Variable

 Expect Error When Syntax Error In For Loop
=======================================
--- /src/robot/variables/variableassigner.py    Tue Sep 11 23:40:55 2012
+++ /src/robot/variables/variableassigner.py    Tue Sep 11 23:55:12 2012
@@ -155,8 +155,8 @@
         return zip(scalars, ret) + [(list_, ret[len(scalars):])]

     def _raise_expected_list(self, ret):
-        self._raise('Expected list-like object, got %s instead.'
-                    % type(ret).__name__)
+ typ = 'string' if isinstance(ret, basestring) else type(ret).__name__
+        self._raise('Expected list-like object, got %s instead.' % typ)

     def _raise_too_few_arguments(self, ret):
         self._raise('Need more values than %d.' % len(ret))

Reply via email to