summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Kögl <stefan@skoegl.net>2013-07-11 21:56:42 +0200
committerStefan Kögl <stefan@skoegl.net>2013-07-11 21:56:42 +0200
commitc84a5567368f4712950909b1e6a135bc0e91e097 (patch)
tree42ae2177c396b31d09008390a47f3670a6087cce
parent28c0c5e3866db552441a66b313d18e0a2cdb7d2b (diff)
downloadpython-json-patch-c84a5567368f4712950909b1e6a135bc0e91e097.tar.gz
test __str__() and to_string()
-rwxr-xr-xtests.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests.py b/tests.py
index a7a365c..bdd6fcf 100755
--- a/tests.py
+++ b/tests.py
@@ -3,6 +3,7 @@
from __future__ import unicode_literals
+import json
import doctest
import unittest
import jsonpatch
@@ -192,6 +193,12 @@ class EqualityTestCase(unittest.TestCase):
self.assertFalse(patch == p)
self.assertFalse(patch == None)
+ def test_str(self):
+ patch_obj = [ { "op": "add", "path": "/child", "value": { "grandchild": { } } } ]
+ patch = jsonpatch.JsonPatch(patch_obj)
+
+ self.assertEqual(json.dumps(patch_obj), str(patch))
+ self.assertEqual(json.dumps(patch_obj), patch.to_string())