We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8f849ea commit 1207d64Copy full SHA for 1207d64
Lib/test/test_typing.py
@@ -961,6 +961,23 @@ def __init__(self, x):
961
self.assertIsInstance(C(1), P)
962
self.assertIsInstance(C(1), PG)
963
964
+ def test_protocol_checks_after_subscript(self):
965
+ class P(Protocol[T]): pass
966
+ class C(P[T]): pass
967
+ class Other1: pass
968
+ class Other2: pass
969
+ CA = C[Any]
970
+
971
+ self.assertNotIsInstance(Other1(), C)
972
+ self.assertNotIsSubclass(Other2, C)
973
974
+ class D1(C[Any]): pass
975
+ class D2(C[Any]): pass
976
+ CI = C[int]
977
978
+ self.assertIsInstance(D1(), C)
979
+ self.assertIsSubclass(D2, C)
980
981
def test_protocols_support_register(self):
982
@runtime_checkable
983
class P(Protocol):
0 commit comments