You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test-data/unit/check-classes.test
+27-13Lines changed: 27 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -4757,7 +4757,9 @@ class C(B):
4757
4757
class X(type): pass
4758
4758
class Y(type): pass
4759
4759
class A(metaclass=X): pass
4760
-
class B(A, metaclass=Y): pass # E: Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases - __main__.Y (meta of __main__.B) conflicting with __main__.X (metaclass of __main__.A)
4760
+
class B(A, metaclass=Y): pass # E: Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases \
4761
+
# N: __main__.Y (meta of __main__.B) conflicts with __main__.X (metaclass of __main__.A)
4762
+
4761
4763
4762
4764
[case testMetaclassNoTypeReveal]
4763
4765
class M:
@@ -5737,8 +5739,8 @@ def f() -> type: return M
5737
5739
class C1(six.with_metaclass(M), object): pass # E: Unsupported dynamic base class "six.with_metaclass"
5738
5740
class C2(C1, six.with_metaclass(M)): pass # E: Unsupported dynamic base class "six.with_metaclass"
5739
5741
class C3(six.with_metaclass(A)): pass # E: Metaclasses not inheriting from "type" are not supported
5740
-
@six.add_metaclass(A) # E: Metaclasses not inheriting from "type" are not supported \
5741
-
# E: Argument 1 to "add_metaclass" has incompatible type "type[A]"; expected "type[type]"
5742
+
@six.add_metaclass(A) # E: Metaclasses not inheriting from "type" are not supported \
5743
+
# E: Argument 1 to "add_metaclass" has incompatible type "type[A]"; expected "type[type]"
5742
5744
5743
5745
class D3(A): pass
5744
5746
class C4(six.with_metaclass(M), metaclass=M): pass # E: Multiple metaclass definitions
class CQA(Q1): pass # E: Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases - __main__.M (meta of __main__.CQA) conflicting with __main__.M1 (metaclass of __main__.Q1)
5758
-
class CQW(six.with_metaclass(M, Q1)): pass # E: Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases - __main__.M (meta of __main__.CQW) conflicting with __main__.M1 (metaclass of __main__.Q1)
5759
+
class CQA(Q1): pass # E: Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases \
5760
+
# N: __main__.M (meta of __main__.CQA) conflicts with __main__.M1 (metaclass of __main__.Q1)
5761
+
class CQW(six.with_metaclass(M, Q1)): pass # E: Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases \
5762
+
# N: __main__.M (meta of __main__.CQW) conflicts with __main__.M1 (metaclass of __main__.Q1)
5763
+
5759
5764
[builtins fixtures/tuple.pyi]
5760
5765
5761
5766
[case testSixMetaclassAny]
@@ -5873,7 +5878,9 @@ class C5(future.utils.with_metaclass(f())): pass # E: Dynamic metaclass not sup
5873
5878
5874
5879
class M1(type): pass
5875
5880
class Q1(metaclass=M1): pass
5876
-
class CQW(future.utils.with_metaclass(M, Q1)): pass # E: Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases - __main__.M (meta of __main__.CQW) conflicting with __main__.M1 (metaclass of __main__.Q1)
5881
+
class CQW(future.utils.with_metaclass(M, Q1)): pass # E: Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases \
5882
+
# N: __main__.M (meta of __main__.CQW) conflicts with __main__.M1 (metaclass of __main__.Q1)
5883
+
5877
5884
[builtins fixtures/tuple.pyi]
5878
5885
5879
5886
[case testFutureMetaclassAny]
@@ -7342,17 +7349,22 @@ class ChildOfCorrectSubclass1(CorrectSubclass1): ...
7342
7349
class CorrectWithType1(C, A1): ...
7343
7350
class CorrectWithType2(B, C): ...
7344
7351
7345
-
class Conflict1(A1, B, E): ... # E: Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases - __main__.MyMeta1 (metaclass of __main__.A) conflicting with __main__.MyMeta2 (metaclass of __main__.B)
7346
-
class Conflict2(A, B): ... # E: Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases - __main__.MyMeta1 (metaclass of __main__.A) conflicting with __main__.MyMeta2 (metaclass of __main__.B)
7347
-
class Conflict3(B, A): ... # E: Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases - __main__.MyMeta2 (metaclass of __main__.B) conflicting with __main__.MyMeta1 (metaclass of __main__.A)
7352
+
class Conflict1(A1, B, E): ... # E: Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases \
7353
+
# N: __main__.MyMeta1 (metaclass of __main__.A) conflicts with __main__.MyMeta2 (metaclass of __main__.B)
7354
+
class Conflict2(A, B): ... # E: Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases \
7355
+
# N: __main__.MyMeta1 (metaclass of __main__.A) conflicts with __main__.MyMeta2 (metaclass of __main__.B)
7356
+
class Conflict3(B, A): ... # E: Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases \
7357
+
# N: __main__.MyMeta2 (metaclass of __main__.B) conflicts with __main__.MyMeta1 (metaclass of __main__.A)
7348
7358
7349
7359
class ChildOfConflict1(Conflict3): ...
7350
7360
class ChildOfConflict2(Conflict3, metaclass=CorrectMeta): ...
7351
7361
7352
7362
class ConflictingMeta(MyMeta1, MyMeta3): ...
7353
-
class Conflict4(A1, B, E, metaclass=ConflictingMeta): ... # E: Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases - __main__.ConflictingMeta (meta of __main__.Conflict4) conflicting with __main__.MyMeta2 (metaclass of __main__.B)
7363
+
class Conflict4(A1, B, E, metaclass=ConflictingMeta): ... # E: Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases \
7364
+
# N: __main__.ConflictingMeta (meta of __main__.Conflict4) conflicts with __main__.MyMeta2 (metaclass of __main__.B)
7354
7365
7355
-
class ChildOfCorrectButWrongMeta(CorrectSubclass1, metaclass=ConflictingMeta): # E: Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases - __main__.ConflictingMeta (meta of __main__.ChildOfCorrectButWrongMeta) conflicting with __main__.CorrectMeta (metaclass of __main__.CorrectSubclass1)
7366
+
class ChildOfCorrectButWrongMeta(CorrectSubclass1, metaclass=ConflictingMeta): # E: Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases \
7367
+
# N: __main__.ConflictingMeta (meta of __main__.ChildOfCorrectButWrongMeta) conflicts with __main__.CorrectMeta (metaclass of __main__.CorrectSubclass1)
7356
7368
...
7357
7369
7358
7370
[case testMetaClassConflictIssue14033]
@@ -7367,8 +7379,10 @@ class B1(metaclass=M2): pass
7367
7379
7368
7380
class C1(metaclass=Mx): pass
7369
7381
7370
-
class TestABC(A2, B1, C1): pass # E: Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases - __main__.M1 (metaclass of __main__.A1) conflicting with __main__.M2 (metaclass of __main__.B1)
7371
-
class TestBAC(B1, A2, C1): pass # E: Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases - __main__.M2 (metaclass of __main__.B1) conflicting with __main__.M1 (metaclass of __main__.A1)
7382
+
class TestABC(A2, B1, C1): pass # E: Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases \
7383
+
# N: __main__.M1 (metaclass of __main__.A1) conflicts with __main__.M2 (metaclass of __main__.B1)
7384
+
class TestBAC(B1, A2, C1): pass # E: Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases \
7385
+
# N: __main__.M2 (metaclass of __main__.B1) conflicts with __main__.M1 (metaclass of __main__.A1)
class B(A, metaclass=Y): pass # E: Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases - __main__.Y (meta of __main__.B) conflicting with __main__.X (metaclass of __main__.A) [metaclass]
1278
+
class B(A, metaclass=Y): pass # E: Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases [metaclass] \
1279
+
# N: __main__.Y (meta of __main__.B) conflicts with __main__.X (metaclass of __main__.A)
0 commit comments