Skip to content

Commit 0225be5

Browse files
committed
saferepr: Remove dead SafeRepr.repr_unicode
This function is not called anywhere directly, and cannot be called by the dynamic `repr_<type>()` dispatch mechanism because unicode is no longer a type in Python 3.
1 parent 0f8b462 commit 0225be5

File tree

1 file changed

+0
-18
lines changed

1 file changed

+0
-18
lines changed

src/_pytest/_io/saferepr.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,6 @@ class SafeRepr(reprlib.Repr):
2525
def repr(self, x):
2626
return self._callhelper(reprlib.Repr.repr, self, x)
2727

28-
def repr_unicode(self, x, level):
29-
# Strictly speaking wrong on narrow builds
30-
def repr(u):
31-
if "'" not in u:
32-
return "'%s'" % u
33-
elif '"' not in u:
34-
return '"%s"' % u
35-
else:
36-
return "'%s'" % u.replace("'", r"\'")
37-
38-
s = repr(x[: self.maxstring])
39-
if len(s) > self.maxstring:
40-
i = max(0, (self.maxstring - 3) // 2)
41-
j = max(0, self.maxstring - 3 - i)
42-
s = repr(x[:i] + x[len(x) - j :])
43-
s = s[:i] + "..." + s[len(s) - j :]
44-
return s
45-
4628
def repr_instance(self, x, level):
4729
return self._callhelper(repr, x)
4830

0 commit comments

Comments
 (0)