jsonpath2 version
0.4.0
Platform Details
sys.platform, sys.version == ('win32', '3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit (Intel)]')
Scenario:
Using negative ranges to query last N elements of an array you get more elements than in the array itself if the array's length is smaller than N.
Steps to Reproduce:
Query $[-10:] on a [1, 2, 3] array
Expected Result:
>>> [m.current_value for m in Path.parse_str('$[-10:]').match([1, 2, 3])]
[1, 2, 3]
>>> [m.current_value for m in Path.parse_str('$[-10:]').match([1, 2, 3, 4, 5, 6, 7, 8])]
[1, 2, 3, 4, 5, 6, 7, 8]
Actual Result:
>>> [m.current_value for m in Path.parse_str('$[-10:]').match([1, 2, 3])]
[1, 2, 3, 1, 2, 3]
>>> [m.current_value for m in Path.parse_str('$[-10:]').match([1, 2, 3, 4, 5, 6, 7, 8])]
[7, 8, 1, 2, 3, 4, 5, 6, 7, 8]
jsonpath2 version
0.4.0
Platform Details
sys.platform, sys.version == ('win32', '3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit (Intel)]')Scenario:
Using negative ranges to query last N elements of an array you get more elements than in the array itself if the array's length is smaller than N.
Steps to Reproduce:
Query
$[-10:]on a[1, 2, 3]arrayExpected Result:
Actual Result: