Skip to content
Merged
Show file tree
Hide file tree
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
Next Next commit
Apply suggestions from code review
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
  • Loading branch information
sobolevn and AlexWaygood authored Mar 14, 2023
commit 4e12bd6f5576e9448906560fffb8741f7758fa0a
21 changes: 9 additions & 12 deletions Lib/test/test_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -3816,18 +3816,15 @@ def test_repr_3(self):
class MyCallable(Generic[P, T]):
pass

self.assertEqual(
repr(MyCallable[[], bool]).split('.')[-1],
'MyCallable[[], bool]',
)
self.assertEqual(
repr(MyCallable[[int], bool]).split('.')[-1],
'MyCallable[[int], bool]',
)
self.assertEqual(
repr(MyCallable[[int, str], bool]).split('.')[-1],
"MyCallable[[int, str], bool]",
)
object_to_expected_repr = {
MyCallable[[], bool]: "MyCallable[[], bool]",
MyCallable[[int], bool]: "MyCallable[[int], bool]",
MyCallable[[int, str], bool]: "MyCallable[[int, str], bool]"
}
Comment thread
sobolevn marked this conversation as resolved.

for obj, expected_repr in object_to_expected_repr.items():
with self.subTest(obj=obj, expected_repr=expected_repr):
self.assertEqual(repr(obj), MyCallable.__module__ + expected_repr)
Comment thread
sobolevn marked this conversation as resolved.
Outdated

def test_eq_1(self):
self.assertEqual(Generic, Generic)
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
Use list instead of tuple in ``repr`` of generic aliases with ``ParamSpec``.
Typing: Improve the ``repr`` of generic aliases for classes generic over a
:class:`~typing.ParamSpec`. (Use square brackets to represent a parameter
list.)