@@ -217,7 +217,7 @@ def relline(self) -> int:
217217 return self .lineno - self .frame .code .firstlineno
218218
219219 def __repr__ (self ) -> str :
220- return "<TracebackEntry %s:%d>" % ( self .frame .code .path , self .lineno + 1 )
220+ return f "<TracebackEntry { self .frame .code .path } : { self .lineno + 1 } >"
221221
222222 @property
223223 def statement (self ) -> Source :
@@ -303,12 +303,7 @@ def __str__(self) -> str:
303303 # This output does not quite match Python's repr for traceback entries,
304304 # but changing it to do so would break certain plugins. See
305305 # https://github.com/pytest-dev/pytest/pull/7535/ for details.
306- return " File %r:%d in %s\n %s\n " % (
307- str (self .path ),
308- self .lineno + 1 ,
309- name ,
310- line ,
311- )
306+ return f" File '{ self .path } ':{ self .lineno + 1 } in { name } \n { line } \n "
312307
313308 @property
314309 def name (self ) -> str :
@@ -953,7 +948,7 @@ def repr_traceback_entry(
953948 if short :
954949 message = f"in { entry .name } "
955950 else :
956- message = excinfo and excinfo .typename or ""
951+ message = ( excinfo and excinfo .typename ) or ""
957952 entry_path = entry .path
958953 path = self ._makepath (entry_path )
959954 reprfileloc = ReprFileLocation (path , entry .lineno + 1 , message )
@@ -1182,10 +1177,8 @@ def toterminal(self, tw: TerminalWriter) -> None:
11821177 entry .toterminal (tw )
11831178 if i < len (self .reprentries ) - 1 :
11841179 next_entry = self .reprentries [i + 1 ]
1185- if (
1186- entry .style == "long"
1187- or entry .style == "short"
1188- and next_entry .style == "long"
1180+ if entry .style == "long" or (
1181+ entry .style == "short" and next_entry .style == "long"
11891182 ):
11901183 tw .sep (self .entrysep )
11911184
@@ -1369,7 +1362,7 @@ def getfslineno(obj: object) -> tuple[str | Path, int]:
13691362 except TypeError :
13701363 return "" , - 1
13711364
1372- fspath = fn and absolutepath (fn ) or ""
1365+ fspath = ( fn and absolutepath (fn ) ) or ""
13731366 lineno = - 1
13741367 if fspath :
13751368 try :
0 commit comments