test-fullautomation / python-jsonpreprocessor

A preprocessor for json files
Apache License 2.0
2 stars 2 forks source link

Value change of dictionary key does not work #209

Closed HolQue closed 2 months ago

HolQue commented 4 months ago

In the first line of the following code, implicitly I create a dictionary with a key (subKey1) inside that is of type dict. In the second line I overwrite this key with an integer value:

${testdict1.subKey1.subKey2} : 1,
${testdict1.subKey1} : 3

Outcome:

Error: 'Could not set variable 'testdict1['subKey1']['subKey2']' with value '1'! Reason: 'int' object does not support item assignment'!

It is astonishing that the error message indicates an error in the first line - because the first line (as stand-alone) works.

Why is it not possible to overwrite the value of a key anywhere in the middle of the key hierarchy?

The expectation is:

{'testdict1': {'subKey1': 3}}

I cross checked with pure Python. This works:

testdict3 = {"A" : {"B" : {"C" : 1}}}
testdict3['A']['B'] = 2
namsonx commented 4 months ago

Hello Holger,

I fixed the issue mentioned in this ticket and pushed the change to stabi branch.

Thank you, Son

HolQue commented 4 months ago

Retest successful. Issue can be closed.

test-fullautomation commented 2 months ago

integrated in RobotFramework AIO 0.11.0