From b5aa705137efca424f759a7c8522472a48aff811 Mon Sep 17 00:00:00 2001 From: "neiljp (Neil Pilgrim)" Date: Sat, 16 Jun 2018 20:59:39 +0000 Subject: [PATCH] mypy: test_link_embed.py: add assert & remove from mypy.ini. --- mypy.ini | 2 -- zerver/tests/test_link_embed.py | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/mypy.ini b/mypy.ini index b48f2ebdd1d79..abc7a6d62ee2c 100644 --- a/mypy.ini +++ b/mypy.ini @@ -361,8 +361,6 @@ strict_optional = False strict_optional = False [mypy-zerver/tests/test_logging_handlers] #73: error: Argument 7 to "makeRecord" of "Logger" has incompatible type "Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]]"; expected "Union[Tuple[type, BaseException, TracebackType], Tuple[None, None, None], None]" strict_optional = False -[mypy-zerver/tests/test_link_embed] #53: error: Value of type "Optional[Dict[Any, Any]]" is not indexable -strict_optional = False [mypy-zerver/tests/test_embedded_bot_system] #26: error: Item "None" of "Optional[UserProfile]" has no attribute "email" strict_optional = False [mypy-zerver/tests/test_decorators] #1322: error: Item "None" of "Optional[Match[str]]" has no attribute "groupdict" diff --git a/zerver/tests/test_link_embed.py b/zerver/tests/test_link_embed.py index 077c51e8da63f..022562eea0c06 100644 --- a/zerver/tests/test_link_embed.py +++ b/zerver/tests/test_link_embed.py @@ -52,6 +52,7 @@ def test_present_provider(self, get: Any) -> None: data = get_oembed_data(url) self.assertIsInstance(data, dict) self.assertIn('title', data) + assert data is not None # allow mypy to infer data is indexable self.assertEqual(data['title'], response_data['title']) @mock.patch('pyoembed.requests.get')