Skip to content

Commit 3a29e88

Browse files
committed
Merge pull request #15 from pontusmelke/rename-new-transaction
Rename new_transaction to begin_transaction
2 parents 4cc4bd4 + 0462a54 commit 3a29e88

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
session.run("MERGE (a:Person {name:'Alice'})")
2727

2828
friends = ["Bob", "Carol", "Dave", "Eve", "Frank"]
29-
with session.new_transaction() as tx:
29+
with session.begin_transaction() as tx:
3030
for friend in friends:
3131
tx.run("MATCH (a:Person {name:'Alice'}) "
3232
"MERGE (a)-[:KNOWS]->(x:Person {name:{n}})", {"n": friend})

neo4j/v1/session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ def close(self):
404404
"""
405405
self.connection.close()
406406

407-
def new_transaction(self):
407+
def begin_transaction(self):
408408
""" Create a new :class:`.Transaction` within this session.
409409
410410
:return: new :class:`.Transaction` instance.

test/test_session.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def test_can_obtain_notification_info(self):
201201
class TransactionTestCase(TestCase):
202202
def test_can_commit_transaction(self):
203203
with GraphDatabase.driver("bolt://localhost").session() as session:
204-
tx = session.new_transaction()
204+
tx = session.begin_transaction()
205205

206206
# Create a node
207207
result = tx.run("CREATE (a) RETURN id(a)")
@@ -222,7 +222,7 @@ def test_can_commit_transaction(self):
222222

223223
def test_can_rollback_transaction(self):
224224
with GraphDatabase.driver("bolt://localhost").session() as session:
225-
tx = session.new_transaction()
225+
tx = session.begin_transaction()
226226

227227
# Create a node
228228
result = tx.run("CREATE (a) RETURN id(a)")
@@ -242,7 +242,7 @@ def test_can_rollback_transaction(self):
242242

243243
def test_can_commit_transaction_using_with_block(self):
244244
with GraphDatabase.driver("bolt://localhost").session() as session:
245-
with session.new_transaction() as tx:
245+
with session.begin_transaction() as tx:
246246
# Create a node
247247
result = tx.run("CREATE (a) RETURN id(a)")
248248
node_id = result[0][0]
@@ -262,7 +262,7 @@ def test_can_commit_transaction_using_with_block(self):
262262

263263
def test_can_rollback_transaction_using_with_block(self):
264264
with GraphDatabase.driver("bolt://localhost").session() as session:
265-
with session.new_transaction() as tx:
265+
with session.begin_transaction() as tx:
266266
# Create a node
267267
result = tx.run("CREATE (a) RETURN id(a)")
268268
node_id = result[0][0]

0 commit comments

Comments
 (0)