diff options
author | Alexander Shorin <kxepal@gmail.com> | 2012-06-16 23:35:57 +0400 |
---|---|---|
committer | Alexander Shorin <kxepal@gmail.com> | 2012-06-16 23:35:57 +0400 |
commit | be9be6d96366c899cb0793e6502a40ccaca57473 (patch) | |
tree | 72d209c4b56269ba9d75a75c8cb015a55d0f7481 /tests.py | |
parent | e90dba067e912ad65e5d7c0d519a5d97ed5f89d4 (diff) | |
download | python-json-patch-be9be6d96366c899cb0793e6502a40ccaca57473.tar.gz |
Let apply_patch to handle patch as JSON-encoded string.
Diffstat (limited to 'tests.py')
-rwxr-xr-x | tests.py | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -8,6 +8,14 @@ import jsonpatch class ApplyPatchTestCase(unittest.TestCase): + def test_apply_patch_from_string(self): + obj = {'foo': 'bar'} + patch = '[{"add": "/baz", "value": "qux"}]' + res = jsonpatch.apply_patch(obj, patch) + self.assertTrue(obj is not res) + self.assertTrue('baz' in res) + self.assertEqual(res['baz'], 'qux') + def test_apply_patch_to_copy(self): obj = {'foo': 'bar'} res = jsonpatch.apply_patch(obj, [{'add': '/baz', 'value': 'qux'}]) |