code: def test_only_1dim_accepted(self):
      arr = np.array([0, 1, 2, 3], dtype="M8[h]").astype("M8[ns]")
  
      depr_msg = "DatetimeArray.__init__ is deprecated"
      with tm.assert_produces_warning(FutureWarning, match=depr_msg):
          with pytest.raises(ValueError, match="Only 1-dimensional"):
              # 3-dim, we allow 2D to sneak in for ops purposes GH#29853
              DatetimeArray(arr.reshape(2, 2, 1))
  
      with tm.assert_produces_warning(FutureWarning, match=depr_msg):
          with pytest.raises(ValueError, match="Only 1-dimensional"):
              # 0-dim
              DatetimeArray(arr[[0]].squeeze())
  
imports: import numpy
  import pytest
  from pandas._libs import iNaT
  from pandas.core.dtypes.dtypes import DatetimeTZDtype
  import pandas
  import pandas._testing
  from pandas.core.arrays import DatetimeArray
label_desc: Use image node_id 2 for calling the TestDatetimeArrayConstructor obj's underlying member method code with example usage: obj.test_only_1dim_accepted() without return types