Skip to content

Commit 034343f

Browse files
committed
summary()->summary
1 parent 3547dd3 commit 034343f

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

neo4j/v1/session.py

+1
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ def get(self, item, default=None):
216216
except (IndexError, KeyError):
217217
return default
218218

219+
@property
219220
def summary(self):
220221
""" Return the summary from the trailing metadata. Note that this is
221222
only available once the entire result stream has been consumed.

test/test_session.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ def test_can_obtain_summary_after_consuming_result(self):
212212
with GraphDatabase.driver("bolt://localhost").session() as session:
213213
cursor = session.run("CREATE (n) RETURN n")
214214
list(cursor.stream())
215-
summary = cursor.summary()
215+
summary = cursor.summary
216216
assert summary.statement == "CREATE (n) RETURN n"
217217
assert summary.parameters == {}
218218
assert summary.statement_type == "rw"
@@ -222,12 +222,12 @@ def test_cannot_obtain_summary_without_consuming_result(self):
222222
with GraphDatabase.driver("bolt://localhost").session() as session:
223223
cursor = session.run("CREATE (n) RETURN n")
224224
with self.assertRaises(ResultError):
225-
_ = cursor.summary()
225+
_ = cursor.summary
226226

227227
# def test_can_obtain_summary_immediately_if_empty_result(self):
228228
# with GraphDatabase.driver("bolt://localhost").session() as session:
229229
# cursor = session.run("CREATE (n)")
230-
# summary = cursor.summary()
230+
# summary = cursor.summary
231231
# assert summary.statement == "CREATE (n)"
232232
# assert summary.parameters == {}
233233
# assert summary.statement_type == "rw"
@@ -237,14 +237,14 @@ def test_no_plan_info(self):
237237
with GraphDatabase.driver("bolt://localhost").session() as session:
238238
cursor = session.run("CREATE (n) RETURN n")
239239
list(cursor.stream())
240-
assert cursor.summary().plan is None
241-
assert cursor.summary().profile is None
240+
assert cursor.summary.plan is None
241+
assert cursor.summary.profile is None
242242

243243
def test_can_obtain_plan_info(self):
244244
with GraphDatabase.driver("bolt://localhost").session() as session:
245245
cursor = session.run("EXPLAIN CREATE (n) RETURN n")
246246
list(cursor.stream())
247-
plan = cursor.summary().plan
247+
plan = cursor.summary.plan
248248
assert plan.operator_type == "ProduceResults"
249249
assert plan.identifiers == ["n"]
250250
assert plan.arguments == {"planner": "COST", "EstimatedRows": 1.0, "version": "CYPHER 3.0",
@@ -256,7 +256,7 @@ def test_can_obtain_profile_info(self):
256256
with GraphDatabase.driver("bolt://localhost").session() as session:
257257
cursor = session.run("PROFILE CREATE (n) RETURN n")
258258
list(cursor.stream())
259-
profile = cursor.summary().profile
259+
profile = cursor.summary.profile
260260
assert profile.db_hits == 0
261261
assert profile.rows == 1
262262
assert profile.operator_type == "ProduceResults"
@@ -270,14 +270,14 @@ def test_no_notification_info(self):
270270
with GraphDatabase.driver("bolt://localhost").session() as session:
271271
cursor = session.run("CREATE (n) RETURN n")
272272
list(cursor.stream())
273-
notifications = cursor.summary().notifications
273+
notifications = cursor.summary.notifications
274274
assert notifications == []
275275

276276
def test_can_obtain_notification_info(self):
277277
with GraphDatabase.driver("bolt://localhost").session() as session:
278278
cursor = session.run("EXPLAIN MATCH (n), (m) RETURN n, m")
279279
list(cursor.stream())
280-
notifications = cursor.summary().notifications
280+
notifications = cursor.summary.notifications
281281

282282
assert len(notifications) == 1
283283
notification = notifications[0]

0 commit comments

Comments
 (0)