summaryrefslogtreecommitdiff
path: root/tests.py
diff options
context:
space:
mode:
authorJonathan Hilliard <jonathan.hilliard@hpe.com>2020-01-28 10:50:45 -0600
committerJonathan Hilliard <jonathan.hilliard@hpe.com>2020-01-28 10:50:45 -0600
commited43114953c231e3feec715c87fa6c17b37cbdf9 (patch)
tree4c75023352feedc11107afdf1343ddfa3dfd5fab /tests.py
parent3e44e04f640a1c10b68d00d2b9a6af0c397f06d7 (diff)
downloadpython-json-patch-ed43114953c231e3feec715c87fa6c17b37cbdf9.tar.gz
Test to reproduce:
https://github.com/stefankoegl/python-json-patch/issues/90 https://github.com/stefankoegl/python-json-patch/issues/103
Diffstat (limited to 'tests.py')
-rwxr-xr-xtests.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests.py b/tests.py
index 07f923b..a9ec48a 100755
--- a/tests.py
+++ b/tests.py
@@ -427,6 +427,24 @@ class MakePatchTestCase(unittest.TestCase):
res = jsonpatch.apply_patch(src, patch)
self.assertEqual(res, dst)
+ def test_issue90(self):
+ """In JSON 1 is different from True even though in python 1 == True"""
+ src = {'A': 1}
+ dst = {'A': True}
+ patch = jsonpatch.make_patch(src, dst)
+ res = jsonpatch.apply_patch(src, patch)
+ self.assertEqual(res, dst)
+ self.assertIsInstance(res['A'], bool)
+
+ def test_issue103(self):
+ """In JSON 1 is different from 1.0 even though in python 1 == 1.0"""
+ src = {'A': 1}
+ dst = {'A': 1.0}
+ patch = jsonpatch.make_patch(src, dst)
+ res = jsonpatch.apply_patch(src, patch)
+ self.assertEqual(res, dst)
+ self.assertIsInstance(res['A'], float)
+
class OptimizationTests(unittest.TestCase):