@@ -2924,13 +2924,10 @@ def test_runtime_checkable_generic_non_protocol(self):
29242924 @runtime_checkable
29252925 class Foo [T ]: ...
29262926
2927- # TODO: RUSTPYTHON
2928- @unittest .expectedFailure
29292927 def test_runtime_checkable_generic (self ):
2930- # @runtime_checkable
2931- # class Foo[T](Protocol):
2932- # def meth(self) -> T: ...
2933- # pass
2928+ @runtime_checkable
2929+ class Foo [T ](Protocol ):
2930+ def meth (self ) -> T : ...
29342931
29352932 class Impl :
29362933 def meth (self ) -> int : ...
@@ -2945,9 +2942,9 @@ def method(self) -> int: ...
29452942 # TODO: RUSTPYTHON
29462943 @unittest .expectedFailure
29472944 def test_pep695_generics_can_be_runtime_checkable (self ):
2948- # @runtime_checkable
2949- # class HasX(Protocol):
2950- # x: int
2945+ @runtime_checkable
2946+ class HasX (Protocol ):
2947+ x : int
29512948
29522949 class Bar [T ]:
29532950 x : T
@@ -2987,22 +2984,20 @@ def f():
29872984
29882985 self .assertIsInstance (f , HasCallProtocol )
29892986
2990- # TODO: RUSTPYTHON
2991- @unittest .expectedFailure
29922987 def test_no_inheritance_from_nominal (self ):
29932988 class C : pass
29942989
2995- # class BP(Protocol): pass
2990+ class BP (Protocol ): pass
29962991
2997- # with self.assertRaises(TypeError):
2998- # class P(C, Protocol):
2999- # pass
3000- # with self.assertRaises(TypeError):
3001- # class Q(Protocol, C):
3002- # pass
3003- # with self.assertRaises(TypeError):
3004- # class R(BP, C, Protocol):
3005- # pass
2992+ with self .assertRaises (TypeError ):
2993+ class P (C , Protocol ):
2994+ pass
2995+ with self .assertRaises (TypeError ):
2996+ class Q (Protocol , C ):
2997+ pass
2998+ with self .assertRaises (TypeError ):
2999+ class R (BP , C , Protocol ):
3000+ pass
30063001
30073002 class D (BP , C ): pass
30083003
@@ -3014,7 +3009,7 @@ class E(C, BP): pass
30143009 # TODO: RUSTPYTHON
30153010 @unittest .expectedFailure
30163011 def test_no_instantiation (self ):
3017- # class P(Protocol): pass
3012+ class P (Protocol ): pass
30183013
30193014 with self .assertRaises (TypeError ):
30203015 P ()
@@ -3042,16 +3037,14 @@ class CG(PG[T]): pass
30423037 with self .assertRaises (TypeError ):
30433038 CG [int ](42 )
30443039
3045- # TODO: RUSTPYTHON
3046- @unittest .expectedFailure
30473040 def test_protocol_defining_init_does_not_get_overridden (self ):
30483041 # check that P.__init__ doesn't get clobbered
30493042 # see https://bugs.python.org/issue44807
30503043
3051- # class P(Protocol):
3052- # x: int
3053- # def __init__(self, x: int) -> None:
3054- # self.x = x
3044+ class P (Protocol ):
3045+ x : int
3046+ def __init__ (self , x : int ) -> None :
3047+ self .x = x
30553048 class C : pass
30563049
30573050 c = C ()
@@ -3478,9 +3471,9 @@ def __getattr__(self, attr):
34783471 # TODO: RUSTPYTHON
34793472 @unittest .expectedFailure
34803473 def test_no_weird_caching_with_issubclass_after_isinstance_pep695 (self ):
3481- # @runtime_checkable
3482- # class Spam[T](Protocol):
3483- # x: T
3474+ @runtime_checkable
3475+ class Spam [T ](Protocol ):
3476+ x : T
34843477
34853478 class Eggs [T ]:
34863479 def __init__ (self , x : T ) -> None :
0 commit comments