>>> tree = Tree({})
>>> tree.execute('1 in $.somekey')
File "objectpath/core/interpreter.py", line 734, in execute
ret = exe(tree)
File "objectpath/core/interpreter.py", line 224, in exe
return exe(node[1]) in exe(node[2])
TypeError: argument of type 'NoneType' is not iterable
Case 2:
>>> tree = Tree({'somekey': 1})
>>> tree.execute('1 in $.somekey')
TypeError: argument of type 'int' is not iterable
Case 3:
>>> tree = Tree({})
>>> tree.execute('count($.somekey) is 0')
File "objectpath/core/interpreter.py", line 734, in execute
ret = exe(tree)
File "objectpath/core/interpreter.py", line 111, in exe
return exe(node[1]) and exe(node[2])
File "objectpath/core/interpreter.py", line 265, in exe
ret = int(fst) == int(snd)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
It would be helpful to handle such cases gracefully (or throw a more specific exception), because quite often the exact structure of input data is not known.
Case 1:
Case 2:
Case 3:
It would be helpful to handle such cases gracefully (or throw a more specific exception), because quite often the exact structure of input data is not known.
ObjectPath version 0.6.1