From 1df98c5bd615f8dc96cf279e1925b64bf8c27a55 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Thu, 2 Jul 2020 00:54:17 +0200 Subject: [PATCH] Remove no_unicode_pprint --- jedi/_compatibility.py | 12 ------------ jedi/api/classes.py | 6 ++---- jedi/inference/context.py | 4 ++-- 3 files changed, 4 insertions(+), 18 deletions(-) diff --git a/jedi/_compatibility.py b/jedi/_compatibility.py index e57c43de..2c8bf488 100644 --- a/jedi/_compatibility.py +++ b/jedi/_compatibility.py @@ -325,18 +325,6 @@ except NameError: pass -def no_unicode_pprint(dct): - """ - Python 2/3 dict __repr__ may be different, because of unicode differens - (with or without a `u` prefix). Normally in doctests we could use `pprint` - to sort dicts and check for equality, but here we have to write a separate - function to do that. - """ - import pprint - s = pprint.pformat(dct) - print(re.sub("u'", "'", s)) - - def utf8_repr(func): """ ``__repr__`` methods in Python 2 don't allow unicode objects to be diff --git a/jedi/api/classes.py b/jedi/api/classes.py index 7edcd2ea..7231fcd0 100644 --- a/jedi/api/classes.py +++ b/jedi/api/classes.py @@ -128,7 +128,6 @@ class BaseName(object): to Jedi, :meth:`jedi.Script.infer` should return a list of definition for ``sys``, ``f``, ``C`` and ``x``. - >>> from jedi._compatibility import no_unicode_pprint >>> from jedi import Script >>> source = ''' ... import keyword @@ -154,7 +153,7 @@ class BaseName(object): so that it is easy to relate the result to the source code. >>> defs = sorted(defs, key=lambda d: d.line) - >>> no_unicode_pprint(defs) # doctest: +NORMALIZE_WHITESPACE + >>> print(defs) # doctest: +NORMALIZE_WHITESPACE [, , , @@ -323,7 +322,6 @@ class BaseName(object): Example: - >>> from jedi._compatibility import no_unicode_pprint >>> from jedi import Script >>> source = ''' ... def f(): @@ -336,7 +334,7 @@ class BaseName(object): >>> script = Script(source) # line is maximum by default >>> defs = script.infer(column=3) >>> defs = sorted(defs, key=lambda d: d.line) - >>> no_unicode_pprint(defs) # doctest: +NORMALIZE_WHITESPACE + >>> print(defs) # doctest: +NORMALIZE_WHITESPACE [, ] >>> str(defs[0].description) # strip literals in python2 diff --git a/jedi/inference/context.py b/jedi/inference/context.py index 60034db6..0915911a 100644 --- a/jedi/inference/context.py +++ b/jedi/inference/context.py @@ -439,7 +439,7 @@ def get_global_filters(context, until_position, origin_scope): For global name lookups. The filters will handle name resolution themselves, but here we gather possible filters downwards. - >>> from jedi._compatibility import u, no_unicode_pprint + >>> from jedi._compatibility import u >>> from jedi import Script >>> script = Script(u(''' ... x = ['a', 'b', 'c'] @@ -455,7 +455,7 @@ def get_global_filters(context, until_position, origin_scope): First we get the names from the function scope. - >>> no_unicode_pprint(filters[0]) # doctest: +ELLIPSIS + >>> print(filters[0]) # doctest: +ELLIPSIS MergedFilter(, ) >>> sorted(str(n) for n in filters[0].values()) # doctest: +NORMALIZE_WHITESPACE ['',