code: def test_monotonic_window():
      w = _MonotonicWindow(maxlen=3)
      assert w == []
      assert len(w) == 0
  
      w.append(1)
      w.append(2)
      w.append(3)
      assert w == [1, 2, 3]
      assert len(w) == 3
      assert w[1] == 2
      assert w[-2:] == [2, 3]
  
      with pytest.raises(NotImplementedError):
          w[1] = 123
      with pytest.raises(NotImplementedError):
          w[1:2] = [1, 2]
  
      with pytest.raises(
          ValueError, match="Expected the value to increase"
      ):
          w.append(2)
      w.clear()
      w.append(2)
  
file_path: pytorch-lightning/tests/tests_fabric/utilities/test_throughput.py
imports: from unittest import mock
  from unittest.mock import Mock, call
  import pytest
  import torch
  from lightning.fabric import Fabric
  from lightning.fabric.plugins import Precision
  from lightning.fabric.utilities.throughput import Throughput, ThroughputMonitor, _MonotonicWindow, get_available_flops, measure_flops
  from tests_fabric.helpers.runif import RunIf
  from tests_fabric.test_fabric import BoringModel
label_desc: Use image node_id 9 for calling a global function with example usage: test_monotonic_window() without return types