mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 13:25:17 +00:00
27 lines
788 B
Python
27 lines
788 B
Python
import warnings
|
|
|
|
"""
|
|
Should emit:
|
|
B028 - on lines 8 and 9
|
|
"""
|
|
|
|
warnings.warn("test", DeprecationWarning)
|
|
warnings.warn("test", DeprecationWarning, source=None)
|
|
warnings.warn("test", DeprecationWarning, source=None, stacklevel=2)
|
|
warnings.warn("test", DeprecationWarning, stacklevel=1)
|
|
warnings.warn("test", DeprecationWarning, 1)
|
|
warnings.warn("test", category=DeprecationWarning, stacklevel=1)
|
|
args = ("test", DeprecationWarning, 1)
|
|
warnings.warn(*args)
|
|
kwargs = {"message": "test", "category": DeprecationWarning, "stacklevel": 1}
|
|
warnings.warn(**kwargs)
|
|
args = ("test", DeprecationWarning)
|
|
kwargs = {"stacklevel": 1}
|
|
warnings.warn(*args, **kwargs)
|
|
|
|
warnings.warn(
|
|
"test",
|
|
DeprecationWarning,
|
|
# some comments here
|
|
source = None # no trailing comma
|
|
)
|