Skip to content

Revert breaking change in summary.notification introduced in #1060 #1093

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/neo4j/_work/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def _notification_from_status(status: dict) -> dict:

return notification

def _set_notifications(self):
def _set_notifications(self) -> None:
if "notifications" in self.metadata:
notifications = self.metadata["notifications"]
if not isinstance(notifications, list):
Expand All @@ -197,7 +197,7 @@ def _set_notifications(self):
continue
notification = self._notification_from_status(status)
notifications.append(notification)
self.notifications = notifications
self.notifications = notifications or None
return

self.notifications = None
Expand Down
3 changes: 2 additions & 1 deletion testkitbackend/totestkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ def serialize_notification(n: neo4j.SummaryNotification) -> dict:

def serialize_notifications() -> list[dict] | None:
if summary_.notifications is None:
return None
gql_aware_protocol = summary_.server.protocol_version >= (5, 5)
return [] if gql_aware_protocol else None
return [
serialize_notification(n) for n in summary_.summary_notifications
]
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/common/work/test_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -1465,7 +1465,7 @@ def test_no_notification_from_status(raw_status, summary_args_kwargs) -> None:
summary.summary_notifications
)

assert notifications == []
assert notifications is None
assert summary_notifications == []


Expand Down Expand Up @@ -1736,7 +1736,7 @@ def test_no_notification_from_wrong_type_status(
notifications = summary.notifications
summary_notifications = summary.summary_notifications

assert notifications == []
assert notifications is None
assert summary_notifications == []


Expand Down Expand Up @@ -1930,7 +1930,7 @@ def test_no_notification_from_status_without_neo4j_code(
notifications = summary.notifications
summary_notifications = summary.summary_notifications

assert notifications == []
assert notifications is None
assert summary_notifications == []


Expand Down Expand Up @@ -2081,7 +2081,7 @@ def test_notification_from_broken_status(
summary = ResultSummary(*args, **kwargs)

notifications = summary.notifications
assert notifications == []
assert notifications is None


def test_notifications_from_statuses_keep_order(
Expand Down