code: def test_check_endog(y, preserve_series, exp, exp_error):
      if exp_error is not None:
          with pytest.raises(exp_error):
              check_endog(y, preserve_series=preserve_series)
      else:
          got = check_endog(y, preserve_series=preserve_series)
  
          # pd.series
          if hasattr(got, "eq"):
              assert isinstance(exp, pd.Series)
              assert exp.eq(got).all()
          else:
              assert_array_equal(exp, got)
  
imports: from pmdarima.utils.array import diff, diff_inv, c, is_iterable, as_series, check_exog, check_endog
  from pmdarima.utils import get_callable
  from numpy.testing import assert_array_equal, assert_array_almost_equal
  import datetime
  import pytest
  import pandas
  import numpy
label_desc: Use image node_id 4 for calling a global function with example usage: test_check_endog(y, preserve_series, exp, exp_error) without return types