Skip to content

Commit d53ee73

Browse files
committed
test(integration): exercise cypher() consistency kwargs; build(demo): bump pin
- Add test_cypher_accepts_consistency_kwargs: write with majority, read back with read_concern=majority + primary + after_index=0, asserts the value round-trips. - Add test_cypher_rejects_invalid_consistency_values: verifies ValueError for strong / w9 / leader / after_index=-1. - Bump Colab embedded + SDK pin to 0b7fd95 in 4 demo notebooks.
1 parent 0b7fd95 commit d53ee73

5 files changed

Lines changed: 46 additions & 9 deletions

File tree

demo/notebooks/00_seed_data.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,14 @@
105105
" \"pip\",\n",
106106
" \"install\",\n",
107107
" \"-q\",\n",
108-
" \"git+https://github.com/structured-world/coordinode-python.git@c2ce32064dd7f6495f0998049c0cc2f6f7a5767d#subdirectory=coordinode-embedded\",\n",
108+
" \"git+https://github.com/structured-world/coordinode-python.git@0b7fd95245f48eab3ae9ddb3e9499171c68a89f4#subdirectory=coordinode-embedded\",\n",
109109
" ],\n",
110110
" check=True,\n",
111111
" timeout=600,\n",
112112
" )\n",
113113
"\n",
114114
"_coordinode_spec = (\n",
115-
" \"git+https://github.com/structured-world/coordinode-python.git@c2ce32064dd7f6495f0998049c0cc2f6f7a5767d#subdirectory=coordinode\"\n",
115+
" \"git+https://github.com/structured-world/coordinode-python.git@0b7fd95245f48eab3ae9ddb3e9499171c68a89f4#subdirectory=coordinode\"\n",
116116
" if IN_COLAB and not os.environ.get(\"COORDINODE_ADDR\")\n",
117117
" else \"coordinode\"\n",
118118
")\n",

demo/notebooks/01_llama_index_property_graph.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
" \"pip\",\n",
9292
" \"install\",\n",
9393
" \"-q\",\n",
94-
" \"git+https://github.com/structured-world/coordinode-python.git@c2ce32064dd7f6495f0998049c0cc2f6f7a5767d#subdirectory=coordinode-embedded\",\n",
94+
" \"git+https://github.com/structured-world/coordinode-python.git@0b7fd95245f48eab3ae9ddb3e9499171c68a89f4#subdirectory=coordinode-embedded\",\n",
9595
" ],\n",
9696
" check=True,\n",
9797
" timeout=600,\n",
@@ -102,7 +102,7 @@
102102
"# The remaining packages (coordinode, llama-index, etc.) are installed without pins:\n",
103103
"# they are pure Python, release frequently, and pip resolves a compatible version.\n",
104104
"_coordinode_spec = (\n",
105-
" \"git+https://github.com/structured-world/coordinode-python.git@c2ce32064dd7f6495f0998049c0cc2f6f7a5767d#subdirectory=coordinode\"\n",
105+
" \"git+https://github.com/structured-world/coordinode-python.git@0b7fd95245f48eab3ae9ddb3e9499171c68a89f4#subdirectory=coordinode\"\n",
106106
" if IN_COLAB and not os.environ.get(\"COORDINODE_ADDR\")\n",
107107
" else \"coordinode\"\n",
108108
")\n",

demo/notebooks/02_langchain_graph_chain.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
" \"pip\",\n",
8989
" \"install\",\n",
9090
" \"-q\",\n",
91-
" \"git+https://github.com/structured-world/coordinode-python.git@c2ce32064dd7f6495f0998049c0cc2f6f7a5767d#subdirectory=coordinode-embedded\",\n",
91+
" \"git+https://github.com/structured-world/coordinode-python.git@0b7fd95245f48eab3ae9ddb3e9499171c68a89f4#subdirectory=coordinode-embedded\",\n",
9292
" ],\n",
9393
" check=True,\n",
9494
" timeout=600,\n",
@@ -102,7 +102,7 @@
102102
"# The remaining packages (coordinode, LangChain, etc.) are installed without pins:\n",
103103
"# they are pure Python, release frequently, and pip resolves a compatible version.\n",
104104
"_coordinode_spec = (\n",
105-
" \"git+https://github.com/structured-world/coordinode-python.git@c2ce32064dd7f6495f0998049c0cc2f6f7a5767d#subdirectory=coordinode\"\n",
105+
" \"git+https://github.com/structured-world/coordinode-python.git@0b7fd95245f48eab3ae9ddb3e9499171c68a89f4#subdirectory=coordinode\"\n",
106106
" if IN_COLAB and not os.environ.get(\"COORDINODE_ADDR\")\n",
107107
" else \"coordinode\"\n",
108108
")\n",
@@ -115,7 +115,7 @@
115115
" \"-q\",\n",
116116
" _coordinode_spec,\n",
117117
" \"langchain\",\n",
118-
" \"git+https://github.com/structured-world/coordinode-python.git@c2ce32064dd7f6495f0998049c0cc2f6f7a5767d#subdirectory=langchain-coordinode\",\n",
118+
" \"git+https://github.com/structured-world/coordinode-python.git@0b7fd95245f48eab3ae9ddb3e9499171c68a89f4#subdirectory=langchain-coordinode\",\n",
119119
" \"langchain-community\",\n",
120120
" \"langchain-openai\",\n",
121121
" \"nest_asyncio\",\n",

demo/notebooks/03_langgraph_agent.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@
4343
"IN_COLAB = \"google.colab\" in sys.modules\n",
4444
"_EMBEDDED_PIP_SPEC = (\n",
4545
" \"git+https://github.com/structured-world/coordinode-python.git\"\n",
46-
" \"@c2ce32064dd7f6495f0998049c0cc2f6f7a5767d#subdirectory=coordinode-embedded\"\n",
46+
" \"@0b7fd95245f48eab3ae9ddb3e9499171c68a89f4#subdirectory=coordinode-embedded\"\n",
4747
")\n",
4848
"_SDK_PIP_SPEC = (\n",
4949
" \"git+https://github.com/structured-world/coordinode-python.git\"\n",
50-
" \"@c2ce32064dd7f6495f0998049c0cc2f6f7a5767d#subdirectory=coordinode\"\n",
50+
" \"@0b7fd95245f48eab3ae9ddb3e9499171c68a89f4#subdirectory=coordinode\"\n",
5151
")\n",
5252
"\n",
5353
"# Install coordinode-embedded in Colab only (requires Rust build).\n",

tests/integration/test_sdk.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,3 +693,40 @@ def test_text_search_fuzzy(client):
693693
client.drop_text_index(idx_name)
694694
finally:
695695
client.cypher(f"MATCH (n:{label} {{tag: $tag}}) DELETE n", params={"tag": tag})
696+
697+
698+
def test_cypher_accepts_consistency_kwargs(client):
699+
"""cypher() wires read_concern / write_concern / read_preference / after_index into the request."""
700+
# Write with majority concern then read back with majority + primary + after_index.
701+
label = f"ConsistencyTest_{uid()}"
702+
tag = uid()
703+
client.cypher(
704+
f"CREATE (n:{label} {{tag: $tag, v: 1}})",
705+
params={"tag": tag},
706+
write_concern="majority",
707+
)
708+
rows = client.cypher(
709+
f"MATCH (n:{label} {{tag: $tag}}) RETURN n.v AS v",
710+
params={"tag": tag},
711+
read_concern="majority",
712+
read_preference="primary",
713+
after_index=0,
714+
)
715+
try:
716+
assert rows and rows[0]["v"] == 1
717+
finally:
718+
client.cypher(f"MATCH (n:{label} {{tag: $tag}}) DELETE n", params={"tag": tag})
719+
720+
721+
def test_cypher_rejects_invalid_consistency_values(client):
722+
"""Invalid consistency kwargs raise ValueError before the RPC."""
723+
import pytest as _pytest
724+
725+
with _pytest.raises(ValueError, match="invalid read_concern"):
726+
client.cypher("RETURN 1", read_concern="strong")
727+
with _pytest.raises(ValueError, match="invalid write_concern"):
728+
client.cypher("RETURN 1", write_concern="w9")
729+
with _pytest.raises(ValueError, match="invalid read_preference"):
730+
client.cypher("RETURN 1", read_preference="leader")
731+
with _pytest.raises(ValueError, match="after_index must be a non-negative integer"):
732+
client.cypher("RETURN 1", after_index=-1)

0 commit comments

Comments
 (0)