Skip to content

Commit c84a556

Browse files
committed
test __str__() and to_string()
1 parent 28c0c5e commit c84a556

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

tests.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from __future__ import unicode_literals
55

6+
import json
67
import doctest
78
import unittest
89
import jsonpatch
@@ -192,6 +193,12 @@ def test_patch_neq_other_objs(self):
192193
self.assertFalse(patch == p)
193194
self.assertFalse(patch == None)
194195

196+
def test_str(self):
197+
patch_obj = [ { "op": "add", "path": "/child", "value": { "grandchild": { } } } ]
198+
patch = jsonpatch.JsonPatch(patch_obj)
199+
200+
self.assertEqual(json.dumps(patch_obj), str(patch))
201+
self.assertEqual(json.dumps(patch_obj), patch.to_string())
195202

196203

197204

0 commit comments

Comments
 (0)