コード例 #1
0
 def test_json_array_append(self):
     self.obj.attrs = JSONArrayAppend(
         "attrs", {"$.arr": "max", "$.arr[0]": 1.1, "$.sub.document": 3}
     )
     self.obj.save()
     self.obj.refresh_from_db()
     assert self.obj.attrs["arr"] == [["dee", 1.1], "arr", "arr", "max"]
     assert self.obj.attrs["sub"]["document"] == ["store", 3]
コード例 #2
0
 def test_json_array_append(self):
     self.obj.attrs = JSONArrayAppend(
         'attrs',
         {'$.arr': 'max', '$.arr[0]': 1.1, '$.sub.document': 3},
     )
     self.obj.save()
     self.obj.refresh_from_db()
     assert self.obj.attrs['arr'] == [['dee', 1.1], 'arr', 'arr', 'max']
     assert self.obj.attrs['sub']['document'] == ['store', 3]