11from __future__ import annotations
22
3+ import itertools
34import os
45import re
56import sys
@@ -414,9 +415,7 @@ def test_parse_frames_groups_repeated_manual_line_offsets() -> None:
414415
415416def test_multibar_clear_removes_only_the_retired_row () -> None :
416417 output : str = (
417- '\x1b [2Fbuild 100%\x1b [2E'
418- '\x1b [1Ftest 50%\x1b [1E'
419- '\x1b [2F\x1b [2K\x1b [2E'
418+ '\x1b [2Fbuild 100%\x1b [2E\x1b [1Ftest 50%\x1b [1E\x1b [2F\x1b [2K\x1b [2E'
420419 )
421420 assert demos .parse_frames (output )[- 1 ] == ['test 50%' ]
422421
@@ -431,8 +430,7 @@ def test_manual_line_offset_capture_shows_four_actual_rows() -> None:
431430 )
432431 assert len (frames [- 1 ]) == 4
433432 assert all (
434- '(20 of 20)' in demos .ANSI_SGR_RE .sub ('' , line )
435- for line in frames [- 1 ]
433+ '(20 of 20)' in demos .ANSI_SGR_RE .sub ('' , line ) for line in frames [- 1 ]
436434 )
437435 assert min (_bar_widths (frames )) >= 20
438436
@@ -450,7 +448,7 @@ def test_parallel_execution_capture_shows_three_active_workers() -> None:
450448 plain_line : str = demos .ANSI_SGR_RE .sub ('' , line )
451449 match : re .Match [str ] | None = demos .PERCENT_RE .search (plain_line )
452450 if match and 0 < int (match .group ()[:- 1 ]) < 100 :
453- active_workers .add (plain_line [:match .start ()].strip ())
451+ active_workers .add (plain_line [: match .start ()].strip ())
454452 if len (active_workers ) >= 3 :
455453 break
456454 else :
@@ -504,16 +502,17 @@ def test_non_tty_capture_keeps_increasing_updates_in_history() -> None:
504502 [
505503 int (match .group ()[:- 1 ])
506504 for line in frame
507- if (match := demos .PERCENT_RE .search (
508- demos .ANSI_SGR_RE .sub ('' , line )
509- ))
505+ if (
506+ match := demos .PERCENT_RE .search (
507+ demos .ANSI_SGR_RE .sub ('' , line )
508+ )
509+ )
510510 ]
511511 for frame in frames
512512 ]
513513 assert max (map (len , frames )) == 4
514514 assert any (
515- len (values ) == 4
516- and all (a < b for a , b in zip (values , values [1 :]))
515+ len (values ) == 4 and all (a < b for a , b in itertools .pairwise (values ))
517516 for values in percentages
518517 )
519518 assert percentages [- 1 ][- 1 ] == 100
@@ -582,7 +581,7 @@ def test_tutorial_recording_preserves_intermediate_progress() -> None:
582581 assert percentages [0 ] == 0
583582 assert percentages [- 1 ] == 100
584583 assert len (set (percentages )) >= 80
585- assert max (b - a for a , b in zip (percentages , percentages [ 1 :] )) <= 2
584+ assert max (b - a for a , b in itertools . pairwise (percentages )) <= 2
586585
587586
588587# Demos whose entire purpose is a time-derived reading (an elapsed duration,
0 commit comments