code: def test_offline_compression(wandb_init, capfd, console):
      # map to old style wrap implementation until test is refactored
      if console == "wrap":
          console = "wrap_emu"
      with capfd.disabled():
          run = wandb_init(
              settings={"console": console, "mode": "offline"}
          )
          run_dir, run_id = run.dir, run.id
  
          for _ in tqdm.tqdm(
              range(100), ncols=139, ascii=" 123456789#"
          ):
              time.sleep(0.05)
  
          print("\n" * 1000)
  
          print("QWERT")
          print("YUIOP")
          print("12345")
  
          print("\x1b[A\r\x1b[J\x1b[A\r\x1b[1J")
  
          time.sleep(2)
          run.finish()
  
          binary_log_file = (
              os.path.join(os.path.dirname(run_dir), "run-" + run_id)
              + ".wandb"
          )
          binary_log = (
              CliRunner()
              .invoke(
                  cli.sync, ["--view", "--verbose", binary_log_file]
              )
              .stdout
          )
  
          # Only a single output record per stream is written when the run finishes
          re_output = re.compile(
              r"^Record: num: \d+\noutput {", flags=re.MULTILINE
          )
          assert len(re_output.findall(binary_log)) == 2
  
          # Only final state of progress bar is logged
          assert binary_log.count("#") == 100, binary_log.count
  
          # Intermediate states are not logged
          assert "QWERT" not in binary_log
          assert "YUIOP" not in binary_log
          assert "12345" not in binary_log
          assert "UIOP" in binary_log
  
file_path: wandb/tests/pytest_tests/system_tests/test_core/test_redir_full.py
imports: import os
  import re
  import time
  from unittest import mock
  import numpy
  import pytest
  import tqdm
  import wandb
  import wandb.sdk.lib.redirect
  import wandb.util
  from click.testing import CliRunner
  from wandb.cli import cli
  from wandb.sdk.lib import runid
label_desc: Use image node_id 2 for calling a global function with example usage: test_offline_compression(wandb_init, capfd, console) without return types