From 0225be53a2e9f8f69536ff91241b30a8b1d313d7 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sun, 14 Jul 2019 21:42:53 +0300 Subject: [PATCH] saferepr: Remove dead SafeRepr.repr_unicode This function is not called anywhere directly, and cannot be called by the dynamic `repr_()` dispatch mechanism because unicode is no longer a type in Python 3. --- src/_pytest/_io/saferepr.py | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/_pytest/_io/saferepr.py b/src/_pytest/_io/saferepr.py index 74f75124f..b5387d205 100644 --- a/src/_pytest/_io/saferepr.py +++ b/src/_pytest/_io/saferepr.py @@ -25,24 +25,6 @@ class SafeRepr(reprlib.Repr): def repr(self, x): return self._callhelper(reprlib.Repr.repr, self, x) - def repr_unicode(self, x, level): - # Strictly speaking wrong on narrow builds - def repr(u): - if "'" not in u: - return "'%s'" % u - elif '"' not in u: - return '"%s"' % u - else: - return "'%s'" % u.replace("'", r"\'") - - s = repr(x[: self.maxstring]) - if len(s) > self.maxstring: - i = max(0, (self.maxstring - 3) // 2) - j = max(0, self.maxstring - 3 - i) - s = repr(x[:i] + x[len(x) - j :]) - s = s[:i] + "..." + s[len(s) - j :] - return s - def repr_instance(self, x, level): return self._callhelper(repr, x)