summaryrefslogtreecommitdiff
path: root/tests.py
diff options
context:
space:
mode:
authorStefan Kögl <stefan@skoegl.net>2014-06-24 20:33:47 +0200
committerStefan Kögl <stefan@skoegl.net>2014-06-24 20:33:47 +0200
commita2e51fb518e02eef9622d00b0009edc6098b1d7a (patch)
tree7d831ab9bf72caad4604ceb2140ba11f393f388b /tests.py
parent036045d79a46df894983dffc0641f535f5cf8d99 (diff)
downloadpython-json-patch-a2e51fb518e02eef9622d00b0009edc6098b1d7a.tar.gz
Fix make_patch() when root is an array (fixes #28)
Diffstat (limited to 'tests.py')
-rwxr-xr-xtests.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests.py b/tests.py
index 88012de..8dff801 100755
--- a/tests.py
+++ b/tests.py
@@ -341,6 +341,14 @@ class MakePatchTestCase(unittest.TestCase):
res = patch.apply(src)
self.assertEqual(res, dst)
+ def test_root_list(self):
+ """ Test making and applying a patch of the root is a list """
+ src = [{'foo': 'bar', 'boo': 'qux'}]
+ dst = [{'baz': 'qux', 'foo': 'boo'}]
+ patch = jsonpatch.make_patch(src, dst)
+ res = patch.apply(src)
+ self.assertEqual(res, dst)
+
class InvalidInputTests(unittest.TestCase):