diff options
author | Stefan Kögl <stefan@skoegl.net> | 2013-07-11 21:56:42 +0200 |
---|---|---|
committer | Stefan Kögl <stefan@skoegl.net> | 2013-07-11 21:56:42 +0200 |
commit | c84a5567368f4712950909b1e6a135bc0e91e097 (patch) | |
tree | 42ae2177c396b31d09008390a47f3670a6087cce | |
parent | 28c0c5e3866db552441a66b313d18e0a2cdb7d2b (diff) | |
download | python-json-patch-c84a5567368f4712950909b1e6a135bc0e91e097.tar.gz |
test __str__() and to_string()
-rwxr-xr-x | tests.py | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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()) |