From 64b5b665cf477a8e920e0e8b57f6b96a2d40f365 Mon Sep 17 00:00:00 2001 From: Benjamin Schubert Date: Sun, 3 Dec 2023 13:49:46 +0000 Subject: [PATCH] pprint: Remove the option to add underscore for numbers This is never used, we can remove this. If we wanted instead, we could always enable it --- src/_pytest/_io/pprint.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/_pytest/_io/pprint.py b/src/_pytest/_io/pprint.py index 4512d3937..ea1073af6 100644 --- a/src/_pytest/_io/pprint.py +++ b/src/_pytest/_io/pprint.py @@ -64,8 +64,6 @@ class PrettyPrinter: indent: int = 4, width: int = 80, depth: Optional[int] = None, - *, - underscore_numbers: bool = False, ) -> None: """Handle pretty printing operations onto a stream using a set of configured parameters. @@ -91,7 +89,6 @@ class PrettyPrinter: self._depth = depth self._indent_per_level = indent self._width = width - self._underscore_numbers = underscore_numbers def pformat(self, object: Any) -> str: sio = _StringIO() @@ -603,12 +600,6 @@ class PrettyPrinter: r = getattr(typ, "__repr__", None) - if issubclass(typ, int) and r is int.__repr__: - if self._underscore_numbers: - return f"{object:_d}" - else: - return repr(object) - if issubclass(typ, dict) and r is dict.__repr__: if not object: return "{}" @@ -659,7 +650,9 @@ class PrettyPrinter: return repr(object) -_builtin_scalars = frozenset({str, bytes, bytearray, float, complex, bool, type(None)}) +_builtin_scalars = frozenset( + {str, bytes, bytearray, float, complex, bool, type(None), int} +) def _recursion(object: Any) -> str: