code: def test_lowess():
      path = "tslumen.profile.smooth.smoothers_lowess.lowess"
      side_effect = lambda data, *args, **kwargs: np.array(
          [[0] * len(data), [kwargs["frac"]] * len(data)]
      ).T
  
      with mock.patch(
          path, side_effect=side_effect, autospec=True
      ) as smoother:
          ser = pd.Series(
              [-2, 3, -2, 3, -2, 3, -2, 3, -2, 3, -2, 3, -2, 3]
          )
          p = lowess(ser).result
          assert isinstance(p, pd.DataFrame)
          assert smoother.call_count == 3
          assert p.columns.tolist() == [
              "original",
              "lowess  5%",
              "lowess 10%",
              "lowess 15%",
          ]
          assert p.iloc[:, 0].equals(ser)
          assert p["lowess  5%"].tolist() == [0.05] * len(ser)
          assert p["lowess 10%"].tolist() == [0.10] * len(ser)
          assert p["lowess 15%"].tolist() == [0.15] * len(ser)
  
      with mock.patch(
          path, side_effect=side_effect, autospec=True
      ) as smoother:
          ser = pd.Series(
              [-2, 3, -2, 3, -2, 3, -2, 3, -2, 3, -2, 3, -2, 3]
          )
          p = lowess(
              ser, fracs=(0.7, 0.95), it=1, delta=0.1, missing="keep"
          ).result
          assert isinstance(p, pd.DataFrame)
          assert smoother.call_count == 2
          for call in smoother.call_args_list:
              assert call[1]["frac"] in [0.7, 0.95]
              assert call[1]["it"] == 1
              assert call[1]["delta"] == 0.1
              assert call[1]["missing"] == "keep"
          assert p.columns.tolist() == [
              "original",
              "lowess 70%",
              "lowess 95%",
          ]
          assert p.iloc[:, 0].equals(ser)
          assert p["lowess 70%"].tolist() == [0.70] * len(ser)
          assert p["lowess 95%"].tolist() == [0.95] * len(ser)
  
file_path: tslumen/tests/unit/profile/test_smooth.py
imports: import pytest
  import mock
  from tests.unit.profile.base import *
  from tslumen.profile.smooth import lowess, rolling_avg, supsmu
label_desc: Use image node_id 2 for calling a global function with example usage: test_lowess() without return types