Check attrs initializers and validators signatures (PY-26354)

This commit is contained in:
Semyon Proshev
2018-05-29 16:50:01 +03:00
parent 121a1ff678
commit 06e2412069
3 changed files with 68 additions and 0 deletions
@@ -0,0 +1,27 @@
import attr
@attr.s
class A:
x = attr.ib()
@x.default
def init_x1(self):
return 10
@x.validator
def check_x1(self, attribute, value):
pass
@attr.s
class A:
x = attr.ib()
@x.default
def init_x2<error descr="'init_x2' should take only 1 parameter">(self, attribute, value)</error>:
return 10
@x.validator
def check_x2<error descr="'check_x2' should take only 3 parameters">(self)</error>:
pass