code: def test_constructor_raises(cls):
      if cls is pd.arrays.StringArray:
          msg = (
              "StringArray requires a sequence of strings or pandas.NA"
          )
      else:
          msg = "Unsupported type '<class 'numpy.ndarray'>' for ArrowExtensionArray"
  
      with pytest.raises(ValueError, match=msg):
          cls(np.array(["a", "b"], dtype="S1"))
  
      with pytest.raises(ValueError, match=msg):
          cls(np.array([]))
  
      if cls is pd.arrays.StringArray:
          # GH#45057 np.nan and None do NOT raise, as they are considered valid NAs
          #  for string dtype
          cls(np.array(["a", np.nan], dtype=object))
          cls(np.array(["a", None], dtype=object))
      else:
          with pytest.raises(ValueError, match=msg):
              cls(np.array(["a", np.nan], dtype=object))
          with pytest.raises(ValueError, match=msg):
              cls(np.array(["a", None], dtype=object))
  
      with pytest.raises(ValueError, match=msg):
          cls(np.array(["a", pd.NaT], dtype=object))
  
      with pytest.raises(ValueError, match=msg):
          cls(np.array(["a", np.datetime64("NaT", "ns")], dtype=object))
  
      with pytest.raises(ValueError, match=msg):
          cls(
              np.array(["a", np.timedelta64("NaT", "ns")], dtype=object)
          )
  
imports: import operator
  import numpy
  import pytest
  from pandas.compat.pyarrow import pa_version_under12p0
  from pandas.core.dtypes.common import is_dtype_equal
  import pandas
  import pandas._testing
  from pandas.core.arrays.string_arrow import ArrowStringArray, ArrowStringArrayNumpySemantics
label_desc: Use image node_id 20 for calling a global function with example usage: test_constructor_raises(cls) without return types