Skip to content

Commit f505d6e

Browse files
committed
position()->position
1 parent 034343f commit f505d6e

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

neo4j/v1/session.py

+1
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ def record(self):
170170
"""
171171
return self._current
172172

173+
@property
173174
def position(self):
174175
""" Return the current cursor position.
175176
"""

test/test_session.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ def test_sessions_are_not_reused_if_still_in_use(self):
8686
def test_can_run_simple_statement(self):
8787
session = GraphDatabase.driver("bolt://localhost").session()
8888
count = 0
89-
for record in session.run("RETURN 1 AS n").stream():
89+
cursor = session.run("RETURN 1 AS n")
90+
assert cursor.position == -1
91+
for record in cursor.stream():
9092
assert record[0] == 1
9193
assert record["n"] == 1
9294
with self.assertRaises(KeyError):
@@ -98,6 +100,7 @@ def test_can_run_simple_statement(self):
98100
_ = record[object()]
99101
assert repr(record)
100102
assert len(record) == 1
103+
assert cursor.position == count
101104
count += 1
102105
session.close()
103106
assert count == 1

0 commit comments

Comments
 (0)