File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -370,4 +370,7 @@ def prettify_docstrings(obj: Type) -> Type:
370370 except AttributeError : # pragma: no cover
371371 pass
372372
373+ if issubclass (obj , tuple ) and obj .__repr__ .__doc__ == "Return a nicely formatted representation string" :
374+ obj .__repr__ .__doc__ = repr_docstring
375+
373376 return obj
Original file line number Diff line number Diff line change 88
99# stdlib
1010import math
11- from typing import Iterable , get_type_hints
11+ from typing import Iterable , NamedTuple , get_type_hints
1212
1313# 3rd party
1414import pytest
@@ -550,3 +550,13 @@ class G(Dictable):
550550 pass
551551
552552 assert prettify_docstrings (G ).__getitem__ .__doc__ != "Return ``self[key]``."
553+
554+
555+ def test_prettify_namedtuple ():
556+
557+ @prettify_docstrings
558+ class T (NamedTuple ):
559+ a : str
560+ b : float
561+
562+ assert T .__repr__ .__doc__ == "Return a string representation of the :class:`~tests.test_doctools.T`."
You can’t perform that action at this time.
0 commit comments