Repository navigation
Multipath - DEL - order by array index even if path lengths are different #531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,6 +69,10 @@ def testDelCommand(env): | |
| res = r.execute_command('JSON.DEL', 'doc2', '$[2,1,0]') | ||
| r.assertEqual(res, 3) | ||
|
|
||
| r.assertOk(r.execute_command('JSON.SET', 'doc2', '$', '[1, 2, 3]')) | ||
| res = r.execute_command('JSON.DEL', 'doc2', '$[1,2,0]') | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why this change?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was initially in a none-descending order, but was worked around a bug, and now can be restored to a less trivial order which would test the reordering required by DEL. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So let's keep them both? |
||
| r.assertEqual(res, 3) | ||
|
|
||
| r.assertOk(r.execute_command('JSON.SET', 'doc2', '$', '{"b": [1,2,3], "a": {"b": [1, 2, 3], "c": [1, 2, 3]}, "x": {"b": [1, 2, 3], "c": [1, 2, 3]}}')) | ||
| res = r.execute_command('JSON.DEL', 'doc2', '$..x.b[*]') | ||
| r.assertEqual(res, 3) | ||
|
|
@@ -88,6 +92,14 @@ def testDelCommand(env): | |
| res = r.execute_command('JSON.GET', 'doc2', '$') | ||
| r.assertEqual(json.loads(res), [[True, {"answer": 42}]]) | ||
|
|
||
| def testDelCommand_issue529(env): | ||
| r = env | ||
| r.assertOk(r.execute_command('JSON.SET', 'doc1', '$', '[{"a00": [{"a00": "a00_00"}, {"a01": "a00_01"}, {"a02": "a00_02"}, {"a03": "a00_03"}]}, {"a01": [{"a00": "a01_00"}, {"a01": "a01_01"}, {"a02": "a01_02"}, {"a03": "a01_03"}]}, {"a02": [{"a00": "a02_00"}, {"a01": "a02_01"}, {"a02": "a02_02"}, {"a03": "a02_03"}]}, {"a03": [{"a00": "a03_00"}, {"a01": "a03_01"}, {"a02": "a03_02"}, {"a03": "a03_03"}]}]')) | ||
| res = r.execute_command('JSON.DEL', 'doc1', '$..[2]') | ||
| r.assertEqual(res, 4) | ||
| res = r.execute_command('JSON.ARRLEN', 'doc1', '$.*[*]') | ||
| r.assertEqual(res, [3, 3, 3]) | ||
|
|
||
|
|
||
| def testForgetCommand(env): | ||
| """Test REJSON.FORGET command""" | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.