Skip to content

Commit 7136417

Browse files
committed
correct false positives
1 parent 49c6cc7 commit 7136417

File tree

3 files changed

+7
-17
lines changed

3 files changed

+7
-17
lines changed

Lib/test/.ruff.toml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,6 @@ extend-exclude = [
1313
]
1414

1515
[lint]
16-
# Variables with single letters and an optional numeric prefix
17-
# are considered to be used, so that we do not need to always
18-
# add a 'F811' suppression.
19-
dummy-variable-rgx = """(?x:^( \
20-
_+ \
21-
|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?) \
22-
|([a-zA-Z][0-9]*) \
23-
)$)"""
24-
2516
select = [
2617
"F811", # Redefinition of unused variable (useful for finding test methods with the same name)
2718
]

Lib/test/test_dataclasses/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -771,12 +771,12 @@ class Point:
771771

772772
# Because this is a ClassVar, it can be mutable.
773773
@dataclass
774-
class C:
774+
class UsesMutableClassVar:
775775
z: ClassVar[typ] = typ()
776776

777777
# Because this is a ClassVar, it can be mutable.
778778
@dataclass
779-
class C:
779+
class UsesMutableClassVarWithSubType:
780780
x: ClassVar[typ] = Subclass()
781781

782782
def test_deliberately_mutable_defaults(self):
@@ -4864,21 +4864,21 @@ class A:
48644864

48654865
# But this usage is okay, since it's not using KW_ONLY.
48664866
@dataclass
4867-
class A:
4867+
class NoDuplicateKwOnlyAnnotation:
48684868
a: int
48694869
_: KW_ONLY
48704870
b: int
48714871
c: int = field(kw_only=True)
48724872

48734873
# And if inheriting, it's okay.
48744874
@dataclass
4875-
class A:
4875+
class BaseUsesKwOnly:
48764876
a: int
48774877
_: KW_ONLY
48784878
b: int
48794879
c: int
48804880
@dataclass
4881-
class B(A):
4881+
class SubclassUsesKwOnly(BaseUsesKwOnly):
48824882
_: KW_ONLY
48834883
d: int
48844884

Lib/test/test_descr.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,10 +1192,9 @@ class C(object):
11921192
pass
11931193
else:
11941194
self.fail("[''] slots not caught")
1195-
class C(object):
1195+
1196+
class WithValidIdentifiers(object):
11961197
__slots__ = ["a", "a_b", "_a", "A0123456789Z"]
1197-
# XXX(nnorwitz): was there supposed to be something tested
1198-
# from the class above?
11991198

12001199
# Test a single string is not expanded as a sequence.
12011200
class C(object):

0 commit comments

Comments
 (0)