Closed HolQue closed 4 weeks ago
Hi Son, as Holger writes I decided yesterday that we don't support slicing. Maybe later we will no, but not now. Reaons:
So, please create an error message in case you find a slicing operator or a negative index (e.g. ${list}[-1]
). Please consider that the negative index can be provided as parameter. E.g. ${list}[${index}]
where the value behind ${index}
is negative.
Positive operator ${list}[+1]
must be allowed. Currently there is a bug. This causes that the whole expression is not resolved.
Thank you, Thomas
Self test: added JPP_1350 - JPP_1364 (topic: slicing; tests commented out)
Hello Holger, Hello Thomas,
I created the commit 48eae0f0df on stabi branch.
I aslo enabled the 2 test cases JPP_1350 - JPP_1364
Thank you, Son
Hi Son,
in one of my commits I wrote: "JPP_1350 - JPP_1364". And the meaning of this is: "from JPP_1350 to JPP_1364", and not: "JPP_1350 and JPP_1364".
All further test cases between 1650 and 1364 are still commented out - and cause errors when I activate them.
But to fix the remaining aspects is for 0.12.x.
Example:
'Expression '${listParam}[:]' cannot be evaluated. Reason: Empty or special character is detected in pair of square brackets.'
Expected: Slicing is not supported
"testParam" : {"key" : ${listParam}[:]}
still causes
Expecting ',' delimiter: line 5 column 1 (char 75)'
Hello Holger,
All blocked slicing's test cases are uncovered and tested successful.
Thank you, Son
Hi Son,
please keep in mind that there is at least one error message active that mentions the possibility to use slices:
'Could not set variable '${testlist}['${intval}']' with value '4'! Reason: list indices must be integers or slices, not str'
That is misleading for the audience, because slicing shall be blocked. In this case you cannot take over the error message from Python.
Hello Holger,
Could you please check error message again, I updated error message as Thomas' suggestion: https://github.com/test-fullautomation/python-jsonpreprocessor/issues/186#issuecomment-1887111574
Thank you, Son
Hi Son,
I still get this error message with slicing proposed:
Error: 'Could not set variable '${listP}['${indexP}']' with value 'newvalue'! Reason: list indices must be integers or slices, not str'!
But "or slices
" is not expected.
Hello Holger,
I updated error message in this case.
Thank you, Son
Retest successful. Issue can be closed.
Released with RobotFramework AIO 0.12.0
Hi Thomas,
based on one of our latest discussions, my understanding now is that slicing shall not be supported (even in case of it's already working partially).
Therefore possibly ongoing development should be stopped.
And slicing notation inside square brackets has to cause a corresponding error message.
Reference:
https://github.com/test-fullautomation/python-jsonpreprocessor/issues/184#issuecomment-1918354577