This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Better return type for get_all_entities_changed
#14604
Merged
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c5d0ea7
Split get_users_whose_devices_changed
erikjohnston db1936e
Better return type for `get_all_entities_changed`
erikjohnston 54c41c9
Newsfile
erikjohnston ec7127f
Docstrings
erikjohnston bd6e404
Merge branch 'develop' into erikj/better_return_type
erikjohnston 0ba4de6
Merge remote-tracking branch 'origin/develop' into erikj/better_retur…
erikjohnston 4b6cd6a
Fix typo
erikjohnston File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Fix a long-standing bug where a device list update might not be sent to clients in certain circumstances. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,21 +70,21 @@ def test_entity_has_changed_pops_off_start(self): | |
self.assertTrue("[email protected]" not in cache._entity_to_key) | ||
|
||
self.assertEqual( | ||
cache.get_all_entities_changed(2), | ||
cache.get_all_entities_changed(2).entities, | ||
["[email protected]", "[email protected]"], | ||
) | ||
self.assertIsNone(cache.get_all_entities_changed(1)) | ||
self.assertFalse(cache.get_all_entities_changed(1).hit) | ||
|
||
# If we update an existing entity, it keeps the two existing entities | ||
cache.entity_has_changed("[email protected]", 5) | ||
self.assertEqual( | ||
{"[email protected]", "[email protected]"}, set(cache._entity_to_key) | ||
) | ||
self.assertEqual( | ||
cache.get_all_entities_changed(2), | ||
cache.get_all_entities_changed(2).entities, | ||
["[email protected]", "[email protected]"], | ||
) | ||
self.assertIsNone(cache.get_all_entities_changed(1)) | ||
self.assertFalse(cache.get_all_entities_changed(1).hit) | ||
|
||
def test_get_all_entities_changed(self): | ||
""" | ||
|
@@ -114,13 +114,15 @@ def test_get_all_entities_changed(self): | |
"[email protected]", | ||
"[email protected]", | ||
] | ||
self.assertTrue(r == ok1 or r == ok2) | ||
self.assertTrue(r.entities == ok1 or r.entities == ok2) | ||
|
||
r = cache.get_all_entities_changed(2) | ||
self.assertTrue(r == ok1[1:] or r == ok2[1:]) | ||
self.assertTrue(r.entities == ok1[1:] or r.entities == ok2[1:]) | ||
|
||
self.assertEqual(cache.get_all_entities_changed(3), ["[email protected]"]) | ||
self.assertEqual(cache.get_all_entities_changed(0), None) | ||
self.assertEqual( | ||
cache.get_all_entities_changed(3).entities, ["[email protected]"] | ||
) | ||
self.assertFalse(cache.get_all_entities_changed(0).hit) | ||
|
||
# ... later, things gest more updates | ||
cache.entity_has_changed("[email protected]", 5) | ||
|
@@ -140,7 +142,7 @@ def test_get_all_entities_changed(self): | |
"[email protected]", | ||
] | ||
r = cache.get_all_entities_changed(3) | ||
self.assertTrue(r == ok1 or r == ok2) | ||
self.assertTrue(r.entities == ok1 or r.entities == ok2) | ||
|
||
def test_has_any_entity_changed(self): | ||
""" | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I'm not 100% sure what makes something
cancellable
, but I think this is OK.