From e55e3adf8d89bc6f6f2627787495613d9758b880 Mon Sep 17 00:00:00 2001 From: joncrall Date: Thu, 28 Sep 2017 20:53:44 -0400 Subject: [PATCH] Fixed some test failures --- jedi/evaluate/docscrape_google.py | 3 ++- jedi/evaluate/docstrings.py | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/jedi/evaluate/docscrape_google.py b/jedi/evaluate/docscrape_google.py index d9cac1711..54ad65444 100644 --- a/jedi/evaluate/docscrape_google.py +++ b/jedi/evaluate/docscrape_google.py @@ -5,6 +5,7 @@ import re import textwrap import collections +from jedi._compatibility import unicode def parse_google_args(docstr): @@ -240,7 +241,7 @@ def split_google_docblocks(docstr): >>> print([k for k, v in groups]) ['Args', 'Returns', 'Example'] """ - if not isinstance(docstr, str): + if not isinstance(docstr, (str, unicode)): raise TypeError('Input docstr must be a string. Got {} instead'.format( type(docstr))) diff --git a/jedi/evaluate/docstrings.py b/jedi/evaluate/docstrings.py index 9bf22fa7d..768b2c7fa 100644 --- a/jedi/evaluate/docstrings.py +++ b/jedi/evaluate/docstrings.py @@ -97,11 +97,11 @@ def _search_param_in_googledocstr(docstr, param_str): ... ' y (int or str or list):', ... ' z ({"foo", "bar", 100500}):', ... ]) - >>> sorted(_search_param_in_googledocstr(docstr, 'x')) + >>> sorted(set(_search_param_in_googledocstr(docstr, 'x'))) ['ndarray'] - >>> sorted(_search_param_in_googledocstr(docstr, 'y')) + >>> sorted(set(_search_param_in_googledocstr(docstr, 'y'))) ['int', 'list', 'str'] - >>> sorted(_search_param_in_googledocstr(docstr, 'z')) + >>> sorted(set(_search_param_in_googledocstr(docstr, 'z'))) ['int', 'str'] """ for garg in docscrape_google.parse_google_args(docstr): @@ -189,7 +189,7 @@ def _search_param_in_docstr(docstr, param_str): return [_strip_rst_role(match.group(1))] return (_search_param_in_numpydocstr(docstr, param_str) or - _search_param_in_googledocstr(docstr, param_str) or + list(_search_param_in_googledocstr(docstr, param_str)) or [])