-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Hi,
I am currently using pytest-accept for this issue of xarray: pydata/xarray#8690
I noticed a bug when a docstring contains a backslash at the end of line, then the lines are not properly replaced, an offset is introduced and it breaks the docstring
Example of a docstring that will surely fail on the xarray repo
Zoom on the section containing a backslash:
combine_attrs : {"drop", "identical", "no_conflicts", "drop_conflicts", \
"override"} or callable, default: "override"This docstring will make the auto-replacement fail. I attach here a screenshot to visually see the issue:
When removing the backslash, the pytest-accept tool successfully replace. Currently as a way to mitigate, I plan to remove all the backslashes at ends of line, running pytest-accept and then git revert the backslash removal.
Thanks!
Edit: the issue is already known and mentioned in the README
it reports line numbers incorrectly in some cases — two docstring lines separated with continuation character \ is counted as one, meaning this library will not have access to the correct line number for doctest inputs and outputs.
