test-fullautomation / python-jsonpreprocessor

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

Error message (9) #256

Open HolQue opened 1 month ago

HolQue commented 1 month ago

Code:

"intParam"  : 1,
"dictParam" : {"A" : 1},
"param"     : ${intParam}[${dictParam}]

Result:

Error: 'Invalid index or dictionary key in parameter '${intParam}[${dictParam}]'. The datatype of variable '${dictParam}' have to 'int' or 'str'.'!

That's wrong. The data type of ${dictParam} is irrelevant. Because of ${intParam} is of data type int. And integers cannot have an index or a key.

The same in pure Python:

intParam  = 1
dictParam = {"A" : 1}
param     = intParam[dictParam]

causes:

TypeError: 'int' object is not subscriptable

Either you take over this original error message from Python interpreter or you provide an own interpretation, something like:

TypeError: Integers cannot have an index or a key.