code: def test_oil(printer, oil):
      """https://otexts.com/fpp2/ses.html#example-oil-production"""
  
      model = HoltWinters(alpha=0.8339)
      model.level.append(446.5868)
      model._initialized = True
  
      template = "{:>2d} | {:>8.2f} | {:>8.2f} | {:>8.2f}"
      printer("t  | y        | level    | y_pred")
      printer("-----------------------------------")
  
      for t, y in enumerate(oil, start=1):
          y_pred = model.forecast(1)[0]
          model.learn_one(y)
          printer(template.format(t, y, model.level[-1], y_pred))
  
      for h, y_pred in enumerate(model.forecast(5), start=1):
          printer(f"{t + h:>2d} |          |          |   {y_pred:.2f}")
  
      expected = """
  t  | y        | level    | y_pred
  -----------------------------------
   1 |   445.36 |   445.57 |   446.59
   2 |   453.19 |   451.93 |   445.57
   3 |   454.41 |   454.00 |   451.93
   4 |   422.38 |   427.63 |   454.00
   5 |   456.04 |   451.32 |   427.63
   6 |   440.39 |   442.20 |   451.32
   7 |   425.19 |   428.02 |   442.20
   8 |   486.21 |   476.54 |   428.02
   9 |   500.43 |   496.46 |   476.54
  10 |   521.28 |   517.15 |   496.46
  11 |   508.95 |   510.31 |   517.15
  12 |   488.89 |   492.45 |   510.31
  13 |   509.87 |   506.98 |   492.45
  14 |   456.72 |   465.07 |   506.98
  15 |   473.82 |   472.36 |   465.07
  16 |   525.95 |   517.05 |   472.36
  17 |   549.83 |   544.39 |   517.05
  18 |   542.34 |   542.68 |   544.39
  19 |          |          |   542.68
  20 |          |          |   542.68
  21 |          |          |   542.68
  22 |          |          |   542.68
  23 |          |          |   542.68"""
  
      assert repr(printer).strip() == expected.strip()
  
file_path: river/river/time_series/test_holt_winters.py
imports: from __future__ import annotations
  import io
  import pytest
  from river.time_series import HoltWinters
label_desc: Use image node_id 5 for calling a global function with example usage: test_oil(printer, oil) without return types