From c84a5567368f4712950909b1e6a135bc0e91e097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20K=C3=B6gl?= Date: Thu, 11 Jul 2013 21:56:42 +0200 Subject: test __str__() and to_string() --- tests.py | 7 +++++++ 1 file changed, 7 insertions(+) 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()) -- cgit v1.2.1