@@ -484,3 +484,56 @@ reveal_type(_TYPE) # N: Revealed type is "def (x: Any) -> builtins.type"
484
484
_TYPE('bar')
485
485
486
486
[builtins fixtures/callable.pyi]
487
+
488
+ [case testErrorMessageAboutSelf]
489
+ # https://github.com/python/mypy/issues/11309
490
+ class Some:
491
+ def method(self, a) -> None: pass
492
+ @classmethod
493
+ def cls_method(cls, a) -> None: pass
494
+ @staticmethod
495
+ def st_method(a) -> None: pass
496
+
497
+ def bad_method(a) -> None: pass
498
+ @classmethod
499
+ def bad_cls_method(a) -> None: pass
500
+ @staticmethod
501
+ def bad_st_method() -> None: pass
502
+
503
+ s: Some
504
+
505
+ s.method(1)
506
+ s.cls_method(1)
507
+ Some.cls_method(1)
508
+ s.st_method(1)
509
+ Some.st_method(1)
510
+
511
+ s.method(1, 2) # E: Too many arguments for "method" of "Some"
512
+ s.cls_method(1, 2) # E: Too many arguments for "cls_method" of "Some"
513
+ Some.cls_method(1, 2) # E: Too many arguments for "cls_method" of "Some"
514
+ s.st_method(1, 2) # E: Too many arguments for "st_method" of "Some"
515
+ Some.st_method(1, 2) # E: Too many arguments for "st_method" of "Some"
516
+
517
+ s.bad_method(1) # E: Too many arguments for "bad_method" of "Some" \
518
+ # N: Looks like the first special argument in a method is not named "self", "cls", or "mcs", maybe it is missing?
519
+ s.bad_cls_method(1) # E: Too many arguments for "bad_cls_method" of "Some" \
520
+ # N: Looks like the first special argument in a method is not named "self", "cls", or "mcs", maybe it is missing?
521
+ Some.bad_cls_method(1) # E: Too many arguments for "bad_cls_method" of "Some" \
522
+ # N: Looks like the first special argument in a method is not named "self", "cls", or "mcs", maybe it is missing?
523
+ s.bad_st_method(1) # E: Too many arguments for "bad_st_method" of "Some"
524
+ Some.bad_st_method(1) # E: Too many arguments for "bad_st_method" of "Some"
525
+ [builtins fixtures/callable.pyi]
526
+
527
+ [case testClassMethodAliasStub]
528
+ from a import f
529
+ f("no") # E: Argument 1 has incompatible type "str"; expected "int"
530
+ [file a.pyi]
531
+ from b import C
532
+ f = C.f
533
+ [file b.pyi]
534
+ import a
535
+ class C(B):
536
+ @classmethod
537
+ def f(self, x: int) -> C: ...
538
+ class B: ...
539
+ [builtins fixtures/classmethod.pyi]
0 commit comments