Embedded arguments with Dictionary variable not working

Hi there,

I’m trying to get embedded keywords working, but I’m hitting a dead end. This is the basis I’m working with:

@keyword(name='Some Test "${var1:[^"]+}" Bla "${var2}"')
def post_request_with_data(self, route: str, data: dict):
    ...

getting called later per

Some Test "${SOME_VAR}[test][etc]" Bla "&{data}"

results in the error Keyword 'Some Test […]' expected 2 arguments, got 1.

Running robot 4.1.1

I’d be thankful for any pointers.

It seems that the problem is due to you using &{data}, not ${data}, when calling the keyword. I’m not exactly sure why that confuses Robot so that this fails with such a strange error. Could you please submit an issue about this? I can take a look could we make the &{data} syntax to work or to at least fail this with some understandable error.

1 Like

Thank you, it seems to work normally if I change the calling part to ${data} (the function still gets a dictionary, not a string). Somehow in my testing I either didn’t test this variant, or something else went wrong when I did. Anyway, since it seems to work now, I can continue my work and will create a issue for you.
Btw. the &{data} variant worked in the old version of the code without embedded variables, and since I’m new to robot, I assumed it worked a bit like Perl and you had to use & if you wanted the variable to stay in dictionary form.

I can’t seem to edit my above post, but here is the issue I created https://github.com/robotframework/robotframework/issues/4207

1 Like