code: def test_compare_to_str(
      self, compval, shape, array_astype, missing_value
  ):
      strs = self.strs.reshape(shape).astype(array_astype)
      if missing_value is None:
          # As of numpy 1.9.2, object array != None returns just False
          # instead of an array, with a deprecation warning saying the
          # behavior will change in the future.  Work around that by just
          # using the ufunc.
          notmissing = np.not_equal(strs, missing_value)
      else:
          if not isinstance(missing_value, array_astype):
              missing_value = array_astype(missing_value, "utf-8")
          notmissing = strs != missing_value
  
      arr = LabelArray(strs, missing_value=missing_value)
  
      if not isinstance(compval, array_astype):
          compval = array_astype(compval, "utf-8")
  
      # arr.missing_value should behave like NaN.
      check_arrays(
          arr == compval,
          (strs == compval) & notmissing,
      )
      check_arrays(
          arr != compval,
          (strs != compval) & notmissing,
      )
  
      np_startswith = np.vectorize(
          lambda elem: elem.startswith(compval)
      )
      check_arrays(
          arr.startswith(compval),
          np_startswith(strs) & notmissing,
      )
  
      np_endswith = np.vectorize(lambda elem: elem.endswith(compval))
      check_arrays(
          arr.endswith(compval),
          np_endswith(strs) & notmissing,
      )
  
      np_contains = np.vectorize(lambda elem: compval in elem)
      check_arrays(
          arr.has_substring(compval),
          np_contains(strs) & notmissing,
      )
  
imports: from itertools import product
  from operator import eq, ne
  import warnings
  import numpy
  from toolz import take
  from zipline.lib.labelarray import LabelArray
  from zipline.testing import check_arrays, parameter_space, ZiplineTestCase
  from zipline.testing.predicates import assert_equal
  from zipline.utils.compat import unicode
label_desc: Use image node_id 3 for calling the LabelArrayTestCase obj's underlying member method code with example usage: obj.test_compare_to_str(compval, shape, array_astype, missing_value) without return types