From bbafc91b570e304fccd3745c47afc3b3544ce207 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Wed, 28 Sep 2022 01:46:14 +0100 Subject: [PATCH] Fix new mypy complaints related to `assertGreater` Presumably due to https://github.com/python/typeshed/pull/8077 --- tests/storage/test_monthly_active_users.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/storage/test_monthly_active_users.py b/tests/storage/test_monthly_active_users.py index e8b4a5644bf7..3da8221109c1 100644 --- a/tests/storage/test_monthly_active_users.py +++ b/tests/storage/test_monthly_active_users.py @@ -96,8 +96,12 @@ def test_initialise_reserved_users(self): # Test each of the registered users is marked as active timestamp = self.get_success(self.store.user_last_seen_monthly_active(user1)) + # Mypy notes that one shouldn't compare Optional[int] to 0 with assertGreater. + # Check that timestamp really is an int. + assert timestamp is not None self.assertGreater(timestamp, 0) timestamp = self.get_success(self.store.user_last_seen_monthly_active(user2)) + assert timestamp is not None self.assertGreater(timestamp, 0) # Test that users with reserved 3pids are not removed from the MAU table @@ -166,9 +170,11 @@ def test_user_last_seen_monthly_active(self): self.get_success(self.store.upsert_monthly_active_user(user_id2)) result = self.get_success(self.store.user_last_seen_monthly_active(user_id1)) + assert result is not None self.assertGreater(result, 0) result = self.get_success(self.store.user_last_seen_monthly_active(user_id3)) + assert result is not None self.assertNotEqual(result, 0) @override_config({"max_mau_value": 5})