Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions tests/pytest/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,15 @@ def testSetWithBracketNotation(env):
r.assertIsNone(r.execute_command('JSON.SET', 'x', '.["f3"].f2', '1')) # Fail trying to set f2 when f3 doesn't exist
r.assertEqual(json.loads(r.execute_command('JSON.GET', 'x')), {'f1': {'f2': [0, {'f.]$.f': 1}, 0]}}) # Make sure it worked

def testGetWithBracketNotation(env):
r = env

r.assertOk(r.execute_command('JSON.SET', 'x', '.', '[1,2,3]'))
r.assertEqual(json.loads(r.execute_command('JSON.GET', 'x', '.[1]')), 2) # dot notation - single value
r.assertEqual(json.loads(r.execute_command('JSON.GET', 'x', '[1]')), 2) # implicit dot notation - single value
r.assertEqual(json.loads(r.execute_command('JSON.GET', 'x', '$.[1]')), [2]) # dollar notation - array
r.assertEqual(json.loads(r.execute_command('JSON.GET', 'x', '$[1]')), [2]) # dollar notation - array

def testSetWithPathErrors(env):
r = env

Expand Down