2424
2525from mock import patch
2626from neo4j .v1 .constants import TRUST_ON_FIRST_USE
27- from neo4j .v1 .exceptions import CypherError , ResultError
27+ from neo4j .v1 .exceptions import CypherError
2828from neo4j .v1 .session import GraphDatabase , basic_auth , Record
2929from neo4j .v1 .typesystem import Node , Relationship , Path
3030
@@ -258,20 +258,19 @@ def test_can_obtain_summary_after_consuming_result(self):
258258 def test_cannot_obtain_summary_without_consuming_result (self ):
259259 with GraphDatabase .driver ("bolt://localhost" , auth = auth_token ).session () as session :
260260 result = session .run ("CREATE (n) RETURN n" )
261- with self .assertRaises (ResultError ):
262- _ = result .summary
261+ assert result .summary is None
263262
264263 def test_no_plan_info (self ):
265264 with GraphDatabase .driver ("bolt://localhost" , auth = auth_token ).session () as session :
266- cursor = session .run ("CREATE (n) RETURN n" )
267- list (cursor )
268- assert cursor .summary .plan is None
269- assert cursor .summary .profile is None
265+ result = session .run ("CREATE (n) RETURN n" )
266+ list (result ) # consume the result
267+ assert result .summary .plan is None
268+ assert result .summary .profile is None
270269
271270 def test_can_obtain_plan_info (self ):
272271 with GraphDatabase .driver ("bolt://localhost" , auth = auth_token ).session () as session :
273272 result = session .run ("EXPLAIN CREATE (n) RETURN n" )
274- list (result )
273+ list (result ) # consume the result
275274 plan = result .summary .plan
276275 assert plan .operator_type == "ProduceResults"
277276 assert plan .identifiers == ["n" ]
@@ -283,7 +282,7 @@ def test_can_obtain_plan_info(self):
283282 def test_can_obtain_profile_info (self ):
284283 with GraphDatabase .driver ("bolt://localhost" , auth = auth_token ).session () as session :
285284 result = session .run ("PROFILE CREATE (n) RETURN n" )
286- list (result )
285+ list (result ) # consume the result
287286 profile = result .summary .profile
288287 assert profile .db_hits == 0
289288 assert profile .rows == 1
@@ -297,14 +296,14 @@ def test_can_obtain_profile_info(self):
297296 def test_no_notification_info (self ):
298297 with GraphDatabase .driver ("bolt://localhost" , auth = auth_token ).session () as session :
299298 result = session .run ("CREATE (n) RETURN n" )
300- list (result )
299+ list (result ) # consume the result
301300 notifications = result .summary .notifications
302301 assert notifications == []
303302
304303 def test_can_obtain_notification_info (self ):
305304 with GraphDatabase .driver ("bolt://localhost" , auth = auth_token ).session () as session :
306305 result = session .run ("EXPLAIN MATCH (n), (m) RETURN n, m" )
307- list (result )
306+ list (result ) # consume the result
308307 notifications = result .summary .notifications
309308
310309 assert len (notifications ) == 1
0 commit comments