Refactor metaclass logic a bit, ensure lambdas are excluded

This commit is contained in:
Joe Farebrother
2025-02-07 21:46:30 +00:00
parent 287cf0121d
commit 61d5a692fb
4 changed files with 31 additions and 34 deletions

View File

@@ -141,3 +141,10 @@ class SpecialMethodNames(object):
def __class_getitem__(cls):
pass
from dataclasses import dataclass, field
@dataclass
class A:
# Lambdas used in initilisation aren't methods.
x: int = field(default_factory = lambda: 2)

View File

@@ -14,7 +14,7 @@ module MethodArgTest implements TestSig {
firstArgShouldBeNamedSelfAndIsnt(f) and
tag = "shouldBeSelf"
or
firstArgShouldBeNamedClsAndIsnt(f) and
firstArgShouldReferToClsAndDoesnt(f) and
tag = "shouldBeCls"
)
)