Skip to content

Commit 30ec43d

Browse files
committed
BUG: Under Py27 use the UTF-8 for ZERO WIDTH SPACE
1 parent bb11821 commit 30ec43d

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

numpydoc/docscrape.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,11 @@ def _parse_param_list(self, content):
258258
r"`(?P<name>(?:~\w+\.)?[a-zA-Z0-9_.-]+)`|"
259259
r" (?P<name2>[a-zA-Z0-9_.-]+))\s*", re.X)
260260

261+
if sys.version_info[0] >= 3:
262+
zerowidthspace = '\u200B'
263+
else:
264+
zerowidthspace = '\xE2\x80\x8B'
265+
261266
def _parse_see_also(self, content):
262267
"""
263268
func_name : Descriptive text
@@ -492,7 +497,8 @@ def _str_see_also(self, func_role):
492497
last_had_desc = True
493498
else:
494499
last_had_desc = False
495-
out += self._str_indent(['\u200B'])
500+
out += self._str_indent([self.zerowidthspace])
501+
496502
if last_had_desc:
497503
out += ['']
498504
out += ['']

numpydoc/tests/test_docscrape.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,12 @@ def _strip_blank_lines(s):
331331

332332

333333
def line_by_line_compare(a, b):
334-
a = textwrap.dedent(a).replace(u'\u200B', '')
334+
if sys.version_info.major >= 3:
335+
zerowidthspace = '\u200B'
336+
else:
337+
zerowidthspace = '\xE2\x80\x8B'
338+
339+
a = textwrap.dedent(a).replace(zerowidthspace, '')
335340
b = textwrap.dedent(b)
336341
a = [l.rstrip() for l in _strip_blank_lines(a).split('\n')]
337342
b = [l.rstrip() for l in _strip_blank_lines(b).split('\n')]

0 commit comments

Comments
 (0)