Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
all type variables are now named T
  • Loading branch information
AlexWaygood authored May 16, 2023
commit 6d3c19a59702cb491a0dbac57efda3f53b7f22e6
12 changes: 6 additions & 6 deletions Lib/test/test_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -3136,18 +3136,18 @@ def bar(self, x: str) -> str:

def test_pep695_generic_protocol_callable_members(self):
@runtime_checkable
class Foo[T_co](Protocol):
def meth(self, x: T_co) -> None: ...
class Foo[T](Protocol):
def meth(self, x: T) -> None: ...

class Bar[T_co]:
def meth(self, x: T_co) -> None: ...
class Bar[T]:
def meth(self, x: T) -> None: ...

self.assertIsInstance(Bar(), Foo)
self.assertIsSubclass(Bar, Foo)

@runtime_checkable
class SupportsTrunc[T_co](Protocol):
def __trunc__(self) -> T_co: ...
class SupportsTrunc[T](Protocol):
def __trunc__(self) -> T: ...

self.assertIsInstance(0.0, SupportsTrunc)
self.assertIsSubclass(float, SupportsTrunc)
Expand Down