diff --git a/src/test_typing_extensions.py b/src/test_typing_extensions.py index f7820ec0..5b5f40be 100644 --- a/src/test_typing_extensions.py +++ b/src/test_typing_extensions.py @@ -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): @@ -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): @@ -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): diff --git a/src/typing_extensions.py b/src/typing_extensions.py index ff5aefea..055994cc 100644 --- a/src/typing_extensions.py +++ b/src/typing_extensions.py @@ -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: @@ -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: @@ -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):