diff --git a/neo4j/v1/session.py b/neo4j/v1/session.py index 2d373e6ac..9cee9a388 100644 --- a/neo4j/v1/session.py +++ b/neo4j/v1/session.py @@ -170,6 +170,7 @@ def record(self): """ return self._current + @property def position(self): """ Return the current cursor position. """ diff --git a/test/test_session.py b/test/test_session.py index 46bd1026e..4cd8b118e 100644 --- a/test/test_session.py +++ b/test/test_session.py @@ -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): @@ -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