Skip to content

Commit

Permalink
position()->position
Browse files Browse the repository at this point in the history
  • Loading branch information
technige committed Feb 22, 2016
1 parent 034343f commit f505d6e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions neo4j/v1/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ def record(self):
"""
return self._current

@property
def position(self):
""" Return the current cursor position.
"""
Expand Down
5 changes: 4 additions & 1 deletion test/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ def test_sessions_are_not_reused_if_still_in_use(self):
def test_can_run_simple_statement(self):
session = GraphDatabase.driver("bolt://localhost").session()
count = 0
for record in session.run("RETURN 1 AS n").stream():
cursor = session.run("RETURN 1 AS n")
assert cursor.position == -1
for record in cursor.stream():
assert record[0] == 1
assert record["n"] == 1
with self.assertRaises(KeyError):
Expand All @@ -98,6 +100,7 @@ def test_can_run_simple_statement(self):
_ = record[object()]
assert repr(record)
assert len(record) == 1
assert cursor.position == count
count += 1
session.close()
assert count == 1
Expand Down

0 comments on commit f505d6e

Please sign in to comment.