summaryrefslogtreecommitdiff
path: root/tests.py
diff options
context:
space:
mode:
authorStefan Kögl <stefan@skoegl.net>2020-01-29 09:15:49 +0100
committerGitHub <noreply@github.com>2020-01-29 09:15:49 +0100
commit91f61241adc9d104e1811eeaf4d9dc6518d6786e (patch)
tree400d360df7c4ef17095931ddfbc0b7f303c9b1ed /tests.py
parentb3726f3a8bdcdf0f0841e078228014de8477b0ec (diff)
parentc1fce712bea25d2fb33b843ccc8f4cd0fca7361d (diff)
downloadpython-json-patch-91f61241adc9d104e1811eeaf4d9dc6518d6786e.tar.gz
Merge pull request #106 from blakehilliard/only-type-diff
Fix issue not recognizing that, in JSON, 1 != 1.0 != True
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 28f0201..cde90b0 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):