Skip to content

Commit f74e7a1

Browse files
author
Johannes Lichtenberger
committed
# Conflicts: # pysirix/json_store.py # pysirix/sync_client.py # tests/test_resource_sync.py # tests/test_sirix_async.py
2 parents 74af286 + 814580e commit f74e7a1

File tree

4 files changed

+26
-22
lines changed

4 files changed

+26
-22
lines changed

pysirix/json_store.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def insert_many(
104104
"""
105105
Inserts a list of records into the store. New records are added at the the tail of the store.
106106
107-
:param insert_list: either a JSON string of ``list`` of ``dict``\\s, or a ``list`` that can be converted to JSON
107+
:param insert_list: either a JSON string of ``list`` of ``dict``s, or a ``list`` that can be converted to JSON
108108
:return: a ``str`` "{rest: []}" or an ``Awaitable[str]`` resolving to this string.
109109
"""
110110
insert_list = dumps(insert_list)

pysirix/sync_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def global_info(self, resources: bool = True) -> List[Dict]:
2626
the endpoint is called with the query ``withResources=true``
2727
2828
:param resources: whether to query resources as well
29-
:return: a ``list`` of ``dict``\\s, where each ``dict`` has a ``name``
29+
:return: a ``list`` of ``dict``s, where each ``dict`` has a ``name``
3030
field, a ``type`` field, and (if ``resources`` is
3131
``True``) a ``resources`` field (containing a ``list`` of names).
3232
:raises: :py:class:`pysirix.SirixServerError`.

tests/test_resource_sync.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,18 @@ def test_update_nonexistent_node():
9292
def test_read_metadata():
9393
resource.create([])
9494
resp = resource.read_with_metadata(1, 1)
95-
assert resp == {
96-
"metadata": {
97-
"nodeKey": 1,
98-
"hash": "4b5c047d20e75862",
99-
"type": "ARRAY",
100-
"descendantCount": 0,
101-
"childCount": 0,
102-
},
103-
"value": [],
104-
}
95+
metadata = resp["metadata"]
96+
# Verify hash exists and is a 16-character hex string
97+
assert "hash" in metadata
98+
assert isinstance(metadata["hash"], str)
99+
assert len(metadata["hash"]) == 16
100+
assert all(c in "0123456789abcdef" for c in metadata["hash"])
101+
# Verify other metadata fields
102+
assert metadata["nodeKey"] == 1
103+
assert metadata["type"] == "ARRAY"
104+
assert metadata["descendantCount"] == 0
105+
assert metadata["childCount"] == 0
106+
assert resp["value"] == []
105107

106108

107109
def test_read_metadata_key_only():

tests/test_sirix_async.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -216,16 +216,18 @@ async def test_read_metadata():
216216
resource = db.resource("test_resource29")
217217
await resource.create([])
218218
resp = await resource.read_with_metadata(1, 1)
219-
assert resp == {
220-
"metadata": {
221-
"nodeKey": 1,
222-
"hash": "4b5c047d20e75862",
223-
"type": "ARRAY",
224-
"descendantCount": 0,
225-
"childCount": 0,
226-
},
227-
"value": [],
228-
}
219+
metadata = resp["metadata"]
220+
# Verify hash exists and is a 16-character hex string
221+
assert "hash" in metadata
222+
assert isinstance(metadata["hash"], str)
223+
assert len(metadata["hash"]) == 16
224+
assert all(c in "0123456789abcdef" for c in metadata["hash"])
225+
# Verify other metadata fields
226+
assert metadata["nodeKey"] == 1
227+
assert metadata["type"] == "ARRAY"
228+
assert metadata["descendantCount"] == 0
229+
assert metadata["childCount"] == 0
230+
assert resp["value"] == []
229231
await sirix.delete_all()
230232
await client.aclose()
231233

0 commit comments

Comments
 (0)