|
20 | 20 |
|
21 | 21 | import pytest |
22 | 22 |
|
| 23 | +from neo4j import ( |
| 24 | + ResultSummary, |
| 25 | + SummaryCounters, |
| 26 | + Plan, |
| 27 | + ProfiledPlan, |
| 28 | + Notification, |
| 29 | + Position, |
| 30 | +) |
| 31 | + |
| 32 | + |
23 | 33 | def get_operator_type(op): |
24 | 34 | # Fabric will suffix with db name, remove this to handle fabric on/off |
25 | 35 | op = op.split("@") |
@@ -72,28 +82,22 @@ def test_no_notification_info(session): |
72 | 82 |
|
73 | 83 |
|
74 | 84 | def test_can_obtain_notification_info(session): |
| 85 | + # python -m pytest tests/integration/test_summary.py -s -v -k test_can_obtain_notification_info |
75 | 86 | result = session.run("EXPLAIN MATCH (n), (m) RETURN n, m") |
76 | 87 | summary = result.consume() |
77 | | - notifications = summary.notifications |
| 88 | + assert isinstance(summary, ResultSummary) |
78 | 89 |
|
| 90 | + notifications = summary.notifications |
| 91 | + assert isinstance(notifications, list) |
79 | 92 | assert len(notifications) == 1 |
| 93 | + |
80 | 94 | notification = notifications[0] |
81 | | - assert notification.code == "Neo.ClientNotification.Statement.CartesianProductWarning" |
82 | | - assert notification.title == "This query builds a cartesian product between " \ |
83 | | - "disconnected patterns." |
84 | | - assert notification.severity == "WARNING" |
85 | | - assert notification.description == "If a part of a query contains multiple " \ |
86 | | - "disconnected patterns, this will build a " \ |
87 | | - "cartesian product between all those parts. This " \ |
88 | | - "may produce a large amount of data and slow down " \ |
89 | | - "query processing. While occasionally intended, " \ |
90 | | - "it may often be possible to reformulate the " \ |
91 | | - "query that avoids the use of this cross product, " \ |
92 | | - "perhaps by adding a relationship between the " \ |
93 | | - "different parts or by using OPTIONAL MATCH " \ |
94 | | - "(identifier is: (m))" |
95 | | - position = notification.position |
96 | | - assert position |
| 95 | + assert isinstance(notification, Notification) |
| 96 | + assert notification.code.startswith("Neo.ClientNotification") # "Neo.ClientNotification.Statement.CartesianProductWarning" |
| 97 | + assert isinstance(notification.title, str) # "This query builds a cartesian product between disconnected patterns." |
| 98 | + assert isinstance(notification.severity, str) # "WARNING" |
| 99 | + assert isinstance(notification.description, str) |
| 100 | + assert isinstance(notification.position, Position) |
97 | 101 |
|
98 | 102 |
|
99 | 103 | def test_contains_time_information(session): |
|
0 commit comments