Skip to content

Commit

Permalink
Make test_docstring compatible with Python 3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
weiji14 committed May 18, 2023
1 parent 071a958 commit 52be9e1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions test/test_datapipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -856,9 +856,14 @@ def test_docstring(self):
"unbatch",
"zip",
]:
docstring = pydoc.render_doc(
thing=getattr(input_dp, dp_funcname), forceload=True
)
if sys.version_info >= (3, 9):
docstring = pydoc.render_doc(
thing=getattr(input_dp, dp_funcname), forceload=True
)
elif sys.version_info < (3, 9):
# pydoc works differently on Python 3.8, see
# https://docs.python.org/3/whatsnew/3.9.html#pydoc
docstring = getattr(input_dp, dp_funcname).__doc__
try:
assert f"(functional name: ``{dp_funcname}``)" in docstring
except AssertionError:
Expand Down

0 comments on commit 52be9e1

Please sign in to comment.