What changed, and why it matters
This commit only adds extra checks to existing automated tests and slightly expands test data. It does not change any production code, wallet logic, or network behavior. There is no security issue here.
No action required; this is a routine test-maintenance commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff modifies tests/test_jsondb.py, adding assertEqual statements to verify expected dictionary state after JSON Patch add/remove operations, and adds an unrelated ‘d’: 3 key to test fixtures for two JsonDB tests. No library or application code is changed.
Changed components
tests/test_jsondb.pyInspect captured patch +6 / −2
diff --git a/tests/test_jsondb.py b/tests/test_jsondb.py
index eeaf410..f0cf30b 100644
--- a/tests/test_jsondb.py
+++ b/tests/test_jsondb.py
@@ -96,10 +96,12 @@ class TestJsonDB(ElectrumTestCase):
patches = [{"op": "add", "path": "/a/b", "value": "42"}]
jpatch = jsonpatch.JsonPatch(patches)
data = jpatch.apply(data)
+ self.assertEqual(data, {'a': {"b": "42"}})
# remove
patches = [{"op": "remove", "path": "/a/b"}]
jpatch = jsonpatch.JsonPatch(patches)
data = jpatch.apply(data)
+ self.assertEqual(data, {'a': {}})
# replace
patches = [{"op": "replace", "path": "/a/b", "value": "43"}]
jpatch = jsonpatch.JsonPatch(patches)
@@ -107,7 +109,7 @@ class TestJsonDB(ElectrumTestCase):
data = jpatch.apply(data)
async def test_jsondb_replace_after_remove(self):
- data = { 'a': {'b': {'c': 0}}}
+ data = { 'a': {'b': {'c': 0}}, 'd': 3}
db = JsonDB(repr(data))
a = db.get_dict('a')
# remove
@@ -119,9 +121,10 @@ class TestJsonDB(ElectrumTestCase):
patches = json.loads('[' + ','.join(db.pending_changes) + ']')
jpatch = jsonpatch.JsonPatch(patches)
data = jpatch.apply(data)
+ self.assertEqual(data, {'a': {}, 'd': 3})
async def test_jsondb_replace_after_remove_nested(self):
- data = { 'a': {'b':{'c':0}}}
+ data = { 'a': {'b': {'c': 0}}, 'd': 3}
db = JsonDB(repr(data))
# remove
a = db.data.pop('a')
@@ -133,3 +136,4 @@ class TestJsonDB(ElectrumTestCase):
patches = json.loads('[' + ','.join(db.pending_changes) + ']')
jpatch = jsonpatch.JsonPatch(patches)
data = jpatch.apply(data)
+ self.assertEqual(data, {'d': 3})
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.