Open HolQue opened 2 months ago
Addendum:
In between the behavior changed.
"testlist" : ["A", "B", "C", "D"],
"param2" : ${testlist}[X]
now causes:
{'param2': "['A', 'B', 'C', 'D'][X]", 'testlist': ['A', 'B', 'C', 'D']}
instead of:
'Invalid syntax! A sub-element in ${testlist}[X] has to enclosed in quotes.'
But the new result is not better than the old one. It makes no sense to return the entire expression as string, with ${testlist}
resolved.
Nevertheless: The previous error message is still implemented:
errorMsg = f"Invalid syntax! A sub-element in {sInput.strip()} has to enclosed in quotes."
But I cannot find this error message in any of my log files. Is this still a valid use case? Or in other words: How must a JSON code look like to cause this error?
Hello Holger,
Thank you for your finding! This is my mistake while improving JsonPreprocessor code. I created the small change to fix it on stabi branch (commit ID: eeaec86fbc)
Thank you, Son
Hi Son,
my question in
https://github.com/test-fullautomation/python-jsonpreprocessor/issues/236#issuecomment-2052070838
is still open.
I would like to know about a use case that causes this error message:
errorMsg = f"Invalid syntax! A sub-element in {sInput.strip()} has to enclosed in quotes."
JSON code:
causes:
'Invalid syntax! A sub-element in ${testlist}[X] has to enclosed in quotes.'
That's wrong. Correct would be something like: "
list indices must be integers
"For example, this works:
Outcome:
'Could not set variable '${testlist}['${intval}']' with value '4'! Reason: list indices must be integers or slices, not str'
Addendum: In between it has been decided to block slicing. Therefore we cannot suggest to use slices. The part "or slices" has to be removed from error message.