summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStas Erema <tyerq@ukr.net>2015-08-18 16:28:07 +0300
committerselurvedu <selurvedu@users.noreply.github.com>2016-04-08 04:38:18 +0000
commit6761340d8b4eae3419eebfb202c09f9956387148 (patch)
treef5909fe006a62dc85b39ddb43eeb94d82f91124b
parentc1067351a798534dda59aadccdfe5eb96fd520b4 (diff)
downloadpython-json-patch-6761340d8b4eae3419eebfb202c09f9956387148.tar.gz
added error-prone cases to default tests
-rwxr-xr-xtests.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests.py b/tests.py
index c5134d3..8da9cfc 100755
--- a/tests.py
+++ b/tests.py
@@ -356,6 +356,38 @@ class MakePatchTestCase(unittest.TestCase):
res = patch.apply(src)
self.assertEqual(res, dst)
+ def test_fail_prone_list_1(self):
+ """ Test making and applying a patch of the root is a list """
+ src = [u'a', u'r', u'b']
+ dst = [u'b', u'o']
+ patch = jsonpatch.make_patch(src, dst)
+ res = patch.apply(src)
+ self.assertEqual(res, dst)
+
+ def test_fail_prone_list_2(self):
+ """ Test making and applying a patch of the root is a list """
+ src = [u'a', u'r', u'b', u'x', u'm', u'n']
+ dst = [u'b', u'o', u'm', u'n']
+ patch = jsonpatch.make_patch(src, dst)
+ res = patch.apply(src)
+ self.assertEqual(res, dst)
+
+ def test_fail_prone_list_3(self):
+ """ Test making and applying a patch of the root is a list """
+ src = [u'boo1', u'bar', u'foo1', u'qux']
+ dst = [u'qux', u'bar']
+ patch = jsonpatch.make_patch(src, dst)
+ res = patch.apply(src)
+ self.assertEqual(res, dst)
+
+ def test_fail_prone_list_4(self):
+ """ Test making and applying a patch of the root is a list """
+ src = [u'bar1', 59, u'foo1', u'foo']
+ dst = [u'foo', u'bar', u'foo1']
+ patch = jsonpatch.make_patch(src, dst)
+ res = patch.apply(src)
+ self.assertEqual(res, dst)
+
class InvalidInputTests(unittest.TestCase):