-
Notifications
You must be signed in to change notification settings - Fork 40
Open
Labels
Bug in dependenciesThe bug is not in the API code but in one of the dependenciesThe bug is not in the API code but in one of the dependencies
Description
PREREQUISITE:
You have installed JSONLibrary
-- > pip install robotframework-jsonlibrary
How to reproduce
- create file
bookstore.robotwith following content
*** Settings ***
Library JSONLibrary
Suite Setup BEFORE TEST SUITE
*** Test Cases ***
Get the last book in order
Get Value From Json ${bookstore_data} $..book[(@.length-1)]
*** Keywords ***
BEFORE TEST SUITE
${bookstore_data}= Load JSON From File ${CURDIR}/bookstore.json
Set Suite Variable ${bookstore_data}
- create file
bookstore.jsonwith JSON data:
{ "store": {
"book": [
{ "category": "reference",
"author": "Nigel Rees",
"title": "Sayings of the Century",
"price": 8.95
},
{ "category": "fiction",
"author": "Evelyn Waugh",
"title": "Sword of Honour",
"price": 12.99
},
{ "category": "fiction",
"author": "Herman Melville",
"title": "Moby Dick",
"isbn": "0-553-21311-3",
"price": 8.99
},
{ "category": "fiction",
"author": "J. R. R. Tolkien",
"title": "The Lord of the Rings",
"isbn": "0-395-19395-8",
"price": 22.99
}
],
"bicycle": {
"color": "red",
"price": 19.95
}
}
}
- execute the test
robot -d results -L TRACE bookstore.robotResult
Parse error at 1:8 near token ( (()
14:19:27.818 DEBUG Traceback (most recent call last):
File "c:\python_virtual_envs\api_requests\lib\site-packages\JSONLibrary\JSONLibraryKeywords.py", line 77, in get_value_from_json
json_path_expr = parse(json_path)
File "c:\python_virtual_envs\api_requests\lib\site-packages\jsonpath_rw_ext\parser.py", line 179, in parse
return ExtentedJsonPathParser(debug=debug).parse(path)
File "c:\python_virtual_envs\api_requests\lib\site-packages\jsonpath_rw\parser.py", line 32, in parse
return self.parse_token_stream(lexer.tokenize(string))
File "c:\python_virtual_envs\api_requests\lib\site-packages\jsonpath_rw\parser.py", line 55, in parse_token_stream
return new_parser.parse(lexer = IteratorToTokenStream(token_iterator))
File "c:\python_virtual_envs\api_requests\lib\site-packages\ply\yacc.py", line 331, in parse
return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
File "c:\python_virtual_envs\api_requests\lib\site-packages\ply\yacc.py", line 1199, in parseopt_notrack
tok = call_errorfunc(self.errorfunc, errtoken, self)
File "c:\python_virtual_envs\api_requests\lib\site-packages\ply\yacc.py", line 193, in call_errorfunc
r = errorfunc(token)
File "c:\python_virtual_envs\api_requests\lib\site-packages\jsonpath_rw\parser.py", line 69, in p_error
raise Exception('Parse error at %s:%s near token %s (%s)' % (t.lineno, t.col, t.value, t.type))Metadata
Metadata
Assignees
Labels
Bug in dependenciesThe bug is not in the API code but in one of the dependenciesThe bug is not in the API code but in one of the dependencies