-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Return an immutable value from get_latest_event_ids_in_room. #16326
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Improve type hints. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -90,7 +90,7 @@ def tearDown(self) -> None: | |
| def test_get_latest_event_ids_in_room(self) -> None: | ||
| create = self.persist(type="m.room.create", key="", creator=USER_ID) | ||
| self.replicate() | ||
| self.check("get_latest_event_ids_in_room", (ROOM_ID,), [create.event_id]) | ||
| self.check("get_latest_event_ids_in_room", (ROOM_ID,), {create.event_id}) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this works because if
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can compare equality of |
||
|
|
||
| join = self.persist( | ||
| type="m.room.member", | ||
|
|
@@ -99,7 +99,7 @@ def test_get_latest_event_ids_in_room(self) -> None: | |
| prev_events=[(create.event_id, {})], | ||
| ) | ||
| self.replicate() | ||
| self.check("get_latest_event_ids_in_room", (ROOM_ID,), [join.event_id]) | ||
| self.check("get_latest_event_ids_in_room", (ROOM_ID,), {join.event_id}) | ||
|
|
||
| def test_redactions(self) -> None: | ||
| self.persist(type="m.room.create", key="", creator=USER_ID) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -261,7 +261,7 @@ def create_room_with_remote_server( | |
|
|
||
| builder = factory.for_room_version(room_version, event_dict) | ||
| join_event = self.get_success( | ||
| builder.build(prev_event_ids=prev_event_ids, auth_event_ids=None) | ||
| builder.build(prev_event_ids=list(prev_event_ids), auth_event_ids=None) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IIRC there is no defined iteration order for a set. I wondered if this might introduce some non-determinism or similar problem... but it should be fine: the order of the prev events list doesn't have any significance.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The order shouldn't matter here is my understanding. |
||
| ) | ||
|
|
||
| self.get_success(federation.on_send_membership_event(remote_server, join_event)) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#16301 incorrectly changes
Collection[str]->StrSequence, but evenCollection[str]is wrong. This needs to be JSON serializable, which pretty much means aListorTuple.