Skip to content

Commit 49b7547

Browse files
committed
Fixed examples
1 parent de23d2b commit 49b7547

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

examples/test_examples.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,20 +172,23 @@ def test_result_summary_query_profile(self):
172172
driver = GraphDatabase.driver("bolt://localhost")
173173
session = driver.session()
174174
# tag::result-summary-query-profile[]
175-
cursor = session.run("PROFILE MATCH (p:Person {name: {name}}) "
175+
result = session.run("PROFILE MATCH (p:Person {name: {name}}) "
176176
"RETURN id(p)", {"name": "The One"})
177-
summary = cursor.summary()
178-
print(summary.statement_type)
179-
print(summary.profile)
177+
while result.next():
178+
pass # skip the records to get to the summary
179+
print(result.summary.statement_type)
180+
print(result.summary.profile)
180181
# end::result-summary-query-profile[]
181182
session.close()
182183

183184
def test_result_summary_notifications(self):
184185
driver = GraphDatabase.driver("bolt://localhost")
185186
session = driver.session()
186187
# tag::result-summary-notifications[]
187-
summary = session.run("EXPLAIN MATCH (a), (b) RETURN a,b").summary()
188-
for notification in summary.notifications:
188+
result = session.run("EXPLAIN MATCH (a), (b) RETURN a,b")
189+
while result.next():
190+
pass # skip the records to get to the summary
191+
for notification in result.summary.notifications:
189192
print(notification)
190193
# end::result-summary-notifications[]
191194
session.close()

runtests.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ echo "Running tests with $(python --version)"
6262
pip install --upgrade -r ${DRIVER_HOME}/test_requirements.txt
6363
echo ""
6464
TEST_RUNNER="coverage run -m ${UNITTEST} discover -vfs ${TEST}"
65+
EXAMPLES_RUNNER="coverage run -m ${UNITTEST} discover -vfs examples"
6566
BEHAVE_RUNNER="behave --tags=-db,-in_dev test/tck"
6667
if [ ${RUNNING} -eq 1 ]
6768
then

0 commit comments

Comments
 (0)