From 11d2f67baa9611988736e178739fef5e6c47ff14 Mon Sep 17 00:00:00 2001 From: disrupted Date: Tue, 11 Mar 2025 22:47:35 +0100 Subject: [PATCH] test: add test cases for decorators --- tests/query/highlights/python/decorators.py | 22 +++++++++++++++++++++ tests/query/highlights/python/functions.py | 7 ------- 2 files changed, 22 insertions(+), 7 deletions(-) create mode 100644 tests/query/highlights/python/decorators.py diff --git a/tests/query/highlights/python/decorators.py b/tests/query/highlights/python/decorators.py new file mode 100644 index 000000000..278e4e311 --- /dev/null +++ b/tests/query/highlights/python/decorators.py @@ -0,0 +1,22 @@ +from dataclasses import dataclass + + +@dataclass +#^^^^^^^^^ @attribute +class Data: + _foo: str + + @property +# ^ @attribute +# ^^^^^^^^ @attribute.builtin + def foo(self) -> str: + return self._foo + + +@pytest.mark.filterwarnings("ignore::DeprecationWarning") +#^^^^^^ @variable +# ^^^^ @variable.member +# ^^^^^^^^^^^^^^ @attribute +def test_func(): + pass + diff --git a/tests/query/highlights/python/functions.py b/tests/query/highlights/python/functions.py index 2c2e7b1b3..6d3028433 100644 --- a/tests/query/highlights/python/functions.py +++ b/tests/query/highlights/python/functions.py @@ -11,10 +11,3 @@ class Foo: Foo().method() # ^^^^^^ @function.method.call - -@pytest.mark.filterwarnings("ignore::DeprecationWarning") -#^^^^^^ @variable -# ^^^^ @variable.member -# ^^^^^^^^^^^^^^ @function.method.call -def test_func(): - pass