def test_when_obj(self):
        def test():
            ...

        with pytest.warns(
            DeprecationWarning,
            match=(
                r"'tests.hikari.internal.test_deprecation.TestWarnDeprecated.test_when_obj.<locals>.test'"
                r" is deprecated and will be removed in a following version."
            ),
        ):
            deprecation.warn_deprecated(test)
 def test_when_version(self):
     with pytest.warns(DeprecationWarning, match=r"'test' is deprecated and will be removed in version 0.0.1"):
         deprecation.warn_deprecated("test", version="0.0.1")
 def test_when_alternative(self):
     with pytest.warns(
         DeprecationWarning,
         match=r"'test' is deprecated and will be removed in a following version. You can use 'foo.bar' instead.",
     ):
         deprecation.warn_deprecated("test", alternative="foo.bar")
Exemple #4
0
 def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None:
     super().__init__(*args, **kwargs)
     # This is called after the super call as __init__ may alter the warnings config
     deprecation.warn_deprecated(BotApp, stack_level=3)