Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
test_decorators: Fix strict_optional errors.
Anders Kaseorgd690cc32e170
diff --git a/mypy.ini b/mypy.iniindex 9f88c5c83b0..cbf524c8fc5 100644--- a/mypy.ini+++ b/mypy.ini@@ -40,8 +40,6 @@ strict_optional = True# Tests (may be many issues in file; comment is just one error noted)-[mypy-zerver/tests/test_decorators] #1322: error: Item "None" of "Optional[Match[str]]" has no attribute "groupdict"-strict_optional = False[mypy-zerver/tests/test_auth_backends] #2079: error: Incompatible types in assignment (expression has type "Optional[UserProfile]", variable has type "UserProfile")strict_optional = False[mypy-zerver/tests/test_signup] #1954: error: Item "None" of "Optional[Match[Any]]" has no attribute "groups"diff --git a/zerver/tests/test_decorators.py b/zerver/tests/test_decorators.pyindex 81aada89bd4..7e666b0ddd6 100644--- a/zerver/tests/test_decorators.py+++ b/zerver/tests/test_decorators.py@@ -565,7 +565,7 @@ body:def test_authenticated_rest_api_view_with_non_webhook_view(self) -> None:@authenticated_rest_api_view()- def non_webhook_view_raises_exception(request: HttpRequest, user_profile: UserProfile=None) -> None:+ def non_webhook_view_raises_exception(request: HttpRequest, user_profile: UserProfile) -> None:raise Exception("raised by a non-webhook view")request = HostRequestMock()@@ -1813,7 +1813,7 @@ class TestUserAgentParsing(ZulipTestCase):for line in open(user_agents_path).readlines():line = line.strip()match = re.match('^(?P<count>[0-9]+) "(?P<user_agent>.*)"$', line)- self.assertIsNotNone(match)+ assert match is not Nonegroupdict = match.groupdict()count = groupdict["count"]user_agent = groupdict["user_agent"]