diff --git a/tests/test_dispatcher/test_dispatcher.py b/tests/test_dispatcher/test_dispatcher.py index 20bc54f6..730a59b2 100644 --- a/tests/test_dispatcher/test_dispatcher.py +++ b/tests/test_dispatcher/test_dispatcher.py @@ -481,10 +481,8 @@ class TestDispatcher: async def test_listen_unknown_update(self): dp = Dispatcher() - with ( - pytest.raises(SkipHandler), - pytest.warns(RuntimeWarning, match="Detected unknown update type") as record, - ): + pattern = "Detected unknown update type" + with pytest.raises(SkipHandler), pytest.warns(RuntimeWarning, match=pattern) as record: await dp._listen_update(Update(update_id=42)) if not record: pytest.fail("Expected 'Detected unknown update type' warning.")