Skip to content

Commit 1865ecb

Browse files
committed
snapshots for refactored classification logic
1 parent 8c1f697 commit 1865ecb

File tree

4 files changed

+24
-11
lines changed

4 files changed

+24
-11
lines changed

crates/ruff_linter/resources/test/fixtures/flake8_unused_arguments/ARG.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ def f(a, b):
189189
# Unused arguments on magic methods.
190190
###
191191
class C:
192+
def __new__(cls, x):
193+
print("Hello, world!")
194+
192195
def __init__(self, x) -> None:
193196
print("Hello, world!")
194197

@@ -198,6 +201,12 @@ def __str__(self) -> str:
198201
def __exit__(self, exc_type, exc_value, traceback) -> None:
199202
print("Hello, world!")
200203

204+
def __init_subclass__(cls, x) -> None:
205+
print("Hello, world!")
206+
207+
def __class_getitem__(cls, x):
208+
print("Hello, world!")
209+
201210

202211
###
203212
# Used arguments on chained cast.

crates/ruff_linter/src/rules/flake8_pyi/rules/custom_type_var_return_type.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,8 @@ impl<'a> ClassMethod<'a> {
189189
}
190190
}
191191

192-
// Dunder new methods (`__new__`, also known as magic methods) are technically static methods,
193-
// with `cls` as their first argument. However, for the purpose of this check, we treat them
194-
// as class methods.
192+
// Dunder new methods (`__new__`) are technically static methods with `cls` as their first argument.
193+
// For simplicity of implementation, we treat them as class methods.
195194
use ClassMethod as DunderNewMethod;
196195

197196
#[derive(Debug)]

crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ARG002_ARG.py.snap

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,11 @@ ARG.py:43:16: ARG002 Unused method argument: `x`
2828
44 | print("Hello, world!")
2929
|
3030

31-
ARG.py:192:24: ARG002 Unused method argument: `x`
31+
ARG.py:195:24: ARG002 Unused method argument: `x`
3232
|
33-
190 | ###
34-
191 | class C:
35-
192 | def __init__(self, x) -> None:
36-
| ^ ARG002
3733
193 | print("Hello, world!")
34+
194 |
35+
195 | def __init__(self, x) -> None:
36+
| ^ ARG002
37+
196 | print("Hello, world!")
3838
|
39-
40-

crates/ruff_linter/src/rules/flake8_unused_arguments/snapshots/ruff_linter__rules__flake8_unused_arguments__tests__ARG004_ARG.py.snap

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,11 @@ ARG.py:55:11: ARG004 Unused static method argument: `x`
2525
56 | print("Hello, world!")
2626
|
2727

28-
28+
ARG.py:192:22: ARG004 Unused static method argument: `x`
29+
|
30+
190 | ###
31+
191 | class C:
32+
192 | def __new__(cls, x):
33+
| ^ ARG004
34+
193 | print("Hello, world!")
35+
|

0 commit comments

Comments
 (0)