Skip to content

Improve some docstrings #167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 11 additions & 0 deletions src/test_typing_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3426,6 +3426,10 @@ def test_eq(self):
# won't be the same.
self.assertNotEqual(hash(ParamSpec('P')), hash(P))

@skipUnless(hasattr(typing, "ParamSpec"), "Only relevant if typing.ParamSpec exists")
def test_consistent_docstring(self):
self.assertEqual(ParamSpec.__doc__, typing.ParamSpec.__doc__)


class ConcatenateTests(BaseTestCase):
def test_basics(self):
Expand Down Expand Up @@ -3788,6 +3792,10 @@ def test_pickle(self):
self.assertEqual(z.__name__, typevartuple.__name__)
self.assertEqual(z.__default__, typevartuple.__default__)

@skipUnless(hasattr(typing, "TypeVarTuple"), "Only relevant if typing.TypeVarTuple exists")
def test_consistent_docstring(self):
self.assertEqual(TypeVarTuple.__doc__, typing.TypeVarTuple.__doc__)


class FinalDecoratorTests(BaseTestCase):
def test_final_unmodified(self):
Expand Down Expand Up @@ -4518,6 +4526,9 @@ def test_cannot_combine_explicit_and_infer(self):
with self.assertRaises(ValueError):
TypeVar('T', contravariant=True, infer_variance=True)

def test_docstring(self):
self.assertEqual(TypeVar.__doc__, typing.TypeVar.__doc__)


class TypeVarLikeDefaultsTests(BaseTestCase):
def test_typevar(self):
Expand Down
9 changes: 3 additions & 6 deletions src/typing_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1390,8 +1390,7 @@ def __instancecheck__(self, __instance: Any) -> bool:


class TypeVar(metaclass=_TypeVarMeta):
"""Type variable."""

__doc__ = typing.TypeVar.__doc__
__module__ = 'typing'

def __init_subclass__(cls) -> None:
Expand Down Expand Up @@ -1482,8 +1481,7 @@ def __instancecheck__(self, __instance: Any) -> bool:
return isinstance(__instance, typing.ParamSpec)

class ParamSpec(metaclass=_ParamSpecMeta):
"""Parameter specification."""

__doc__ = typing.ParamSpec.__doc__
__module__ = 'typing'

def __init_subclass__(cls) -> None:
Expand Down Expand Up @@ -2106,8 +2104,7 @@ def __instancecheck__(self, __instance: Any) -> bool:
return isinstance(__instance, typing.TypeVarTuple)

class TypeVarTuple(metaclass=_TypeVarTupleMeta):
"""Type variable tuple."""

__doc__ = typing.TypeVarTuple.__doc__
__module__ = 'typing'

def __init_subclass__(self, *args, **kwds):
Expand Down