code: def test_forward_to_pause(
      flow_tester, ops_factory, size_offset, paused
  ):
      ft = flow_tester(high=300, mid=200, low=100)
      ops = ops_factory()
  
      batch_prep = [ops.op(size=100) for _ in range(2)]
      batch_test1 = [ops.op(size=(100 + size_offset))]
      batch_test2 = [ops.op(size=100)]
      batch_post = [ops.op(size=100) for _ in range(2)]
  
      for op in batch_prep:
          ft.add(op)
          assert ft.state == State.FORWARDING
      assert batch_prep == ft.written
      assert batch_prep == ft.forwarded_ops
  
      for op in batch_test1:
          ft.add(op)
          assert ft.state == (
              State.PAUSING if paused else State.FORWARDING
          )
      assert batch_test1 == ft.written
      assert batch_test1 == ft.forwarded_ops
  
      for op in batch_test2:
          ft.add(op)
          assert ft.state == State.PAUSING
      assert batch_test2 == ft.written
      assert (batch_test2 if not paused else []) == ft.forwarded_ops
  
      for op in batch_post:
          ft.add(op)
          assert ft.state == State.PAUSING
      assert batch_post == ft.written
      assert [] == ft.forwarded_ops
  
      assert [] == ft.recovered
  
imports: import json
  import time
  from dataclasses import dataclass
  from enum import Enum
  import pytest
  from wandb.proto import wandb_internal_pb2
  from wandb.sdk.internal import flow_control, settings_static
  from wandb.sdk.lib import proto_util
  from wandb.sdk.wandb_settings import Settings
label_desc: Use image node_id 3 for calling a global function with example usage: test_forward_to_pause(flow_tester, ops_factory, size_offset, paused) without return types