Skip to content

Commit dce9cfe

Browse files
committed
Remove non-core methods
1 parent 9af43eb commit dce9cfe

File tree

2 files changed

+6
-30
lines changed

2 files changed

+6
-30
lines changed

neo4j/v1/session.py

-26
Original file line numberDiff line numberDiff line change
@@ -218,32 +218,6 @@ def summarize(self):
218218
self._consume()
219219
return self._summary
220220

221-
def skip(self, records):
222-
""" Move the cursor forward by a number of records.
223-
224-
:arg records: the number of records to step over
225-
"""
226-
if records < 0:
227-
raise ValueError("Cannot skip a negative number of records")
228-
skipped = 0
229-
while skipped < records and self.next():
230-
skipped += 1
231-
return skipped
232-
233-
def first(self):
234-
""" Attempt to navigate to the first record in this stream, returning
235-
``True`` if this is possible, ``False`` otherwise.
236-
"""
237-
if self._position < 0:
238-
return self.next()
239-
else:
240-
return self._position == 0
241-
242-
def single(self):
243-
""" Return ``True`` if able to navigate to first and only record.
244-
"""
245-
return self.first() and self.at_end()
246-
247221
def _consume(self):
248222
# Consume the remainder of this result, triggering all appropriate callback functions.
249223
fetch_next = self._connection.fetch_next

test/test_examples.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,9 @@ def test_transaction_commit(self):
127127
tx.commit()
128128
# end::transaction-commit[]
129129
cursor = session.run("MATCH (p:Person {name: 'The One'}) RETURN count(p)")
130-
assert cursor.single()
131-
assert cursor.record()["count(p)"] == 1
130+
assert cursor.next()
131+
assert cursor["count(p)"] == 1
132+
assert cursor.at_end()
132133
session.close()
133134
driver.close()
134135

@@ -141,8 +142,9 @@ def test_transaction_rollback(self):
141142
tx.rollback()
142143
# end::transaction-rollback[]
143144
cursor = session.run("MATCH (p:Person {name: 'The One'}) RETURN count(p)")
144-
assert cursor.single()
145-
assert cursor.record()["count(p)"] == 0
145+
assert cursor.next()
146+
assert cursor["count(p)"] == 0
147+
assert cursor.at_end()
146148
session.close()
147149
driver.close()
148150

0 commit comments

Comments
 (0)