attrs/tests/test_mypy.yml

24 lines
588 B
YAML

- case: attr_s_with_type_argument
parametrized:
- val: 'a = attr.ib(type=int)'
- val: 'a: int = attr.ib()'
main: |
import attr
@attr.s
class C:
{{ val }}
C() # E: Too few arguments for "C"
C(1)
C(a=1)
C(a="hi") # E: Argument "a" to "C" has incompatible type "str"; expected "int"
- case: attr_s_with_type_annotations
main : |
import attr
@attr.s
class C:
a: int = attr.ib()
C() # E: Too few arguments for "C"
C(1)
C(a=1)
C(a="hi") # E: Argument "a" to "C" has incompatible type "str"; expected "int"