Skip to content

Commit

Permalink
Apply patch for Python 3.8 on TestFunctionalMapDataPipe.test_docstring
Browse files Browse the repository at this point in the history
Same as 52be9e1  but for MapDataPipe
  • Loading branch information
weiji14 committed May 18, 2023
1 parent 5cb2bf8 commit ee5272e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test/test_datapipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -1948,7 +1948,14 @@ def test_docstring(self):
"shuffle",
"zip",
]:
docstring = pydoc.render_doc(thing=getattr(input_dp, dp_funcname))
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__
assert f"(functional name: ``{dp_funcname}``)" in docstring
assert "Args:" in docstring
assert "Example:" in docstring or "Examples:" in docstring
Expand Down

0 comments on commit ee5272e

Please sign in to comment.