Skip to content

Value change of dictionary key does not work (2) #210

@HolQue

Description

@HolQue

In the first line of the following code, implicitly I create a dictionary with some subkeys. In the second line I assign this dictionary to another one.

${testdict1.subKey1.subKey2} : 1,
"testdict2" : ${testdict1}

The outcome is like expected:

{'testdict1': {'subKey1': {'subKey2': 1}},
 'testdict2': {'subKey1': {'subKey2': 1}}}

I extend the code by a third line in which I recreate the entire testdict1:

${testdict1.subKey1.subKey2} : 1,
"testdict2" : ${testdict1},
${testdict1.subKey1.subKey2} : 2

Result:

Error: 'The variable '${testdict1}' is not available!'!

Astonishing. Why is the variable '${testdict1}' not available any more?

Expected is:

{'testdict1': {'subKey1': {'subKey2': 2}},
 'testdict2': {'subKey1': {'subKey2': 1}}}

I cross checked with pure Python. This works:

testdict1 = {"A" : {"B" : {"C" : 1}}}
testdict2 = testdict1
testdict1 = {"A" : {"B" : {"C" : 2}}}

C of testdict1 has new value 2.
C of testdict2 still has initial value 1.

I think in JsonPreprocessor such assignments should work in the same way as in pure Python.

Issue similar to

#209

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions