Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 280 by [email protected]: Strange handling of empty lists
http://code.google.com/p/robotframework/issues/detail?id=280

Using Robot Framework 2.0.4 (Python 2.6 on linux2)

We have a global variable @{gl}. Let's assume, that this variable already
has some contents, for example [ This | is | a | list ]. Now we have some
user keyword, which returns a list (but for demonstration, we can as well
use the builtin "Create List"). We want to assign the result of the
keyword to the global variable, hence we have to set a local list variable
first. If the local variable is an empty list, then "Set Global Variable"
has no effect. See good example:

| Set Global Variable | \...@{gl}      | This | is | a | list |
| @{l}=               | Create List | Short|List|   |      |
| Set Global Variable | \...@{gl}      | @{l} |    |   |      |

Okay, @{gl} is set to the contents of @{l}.

Bad example:

| Set Global Variable | \...@{gl}      | This | is | a | list |
| @{l}=               | Create List |      |    |   |      |
| Set Global Variable | \...@{gl}      | @{l} |    |   |      |

FAULT: @{gl} remains unchanged ! "Set Global Variable" keyword apparently
interprets the empy list @{l} as "less than nothing", which means it
doesn't do anything!

If we set @{l} to ${EMPTY}, the @{gl} is changed, but the @{l} and
afterwards @{gl} is not an empty list, but a list containing one empty
element, which is a difference (for example to the "Log Many" keyword).

Another strange thing: "Set Variable" keyword can assign lists, but raises
an error in case of an empty list. Example:

| @{l}=     | Set Variable |     |     |

results in error "Cannot assign return value of keyword 'BuiltIn.Set
Variable' to variable '@{l}': Expected list, got string instead", which is
quite nonsense. In particular, if the empty list to assign is another
variable, for example:

| @{empty_list}=   | Create List  |               |      |
| @{l}=            | Set Variable | @{empty_list} |      |


Imagine in the above example, that instead "Create List" we have a user
keyword, which may return an empty or non-empty list, depending on time of
day, for instance.

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

Reply via email to