code: def test_dtype_with_str():
      # dtype object is not supported
      text = np.array(["foo", None, "bar"])
      assert text.dtype == object
      with pytest.raises(
          ValueError, match=".*Unsupported dtype object*"
      ), pytest.warns(UserWarning):
          array_to_json(text)
      # but if they contain all strings, it should convert them.
      # This is for backward compatibility of expecting pandas dataframe
      # string columns to work (which are of dtype==np.object)
      text[1] = "foobar"
      assert array_to_json(text) == ["foo", "foobar", "bar"]
  
file_path: bqplot/tests/binary_serialization_test.py
imports: import bqplot
  import numpy
  import pandas
  from bqplot.traits import array_to_json, array_from_json
  import pytest
label_desc: Use image node_id 4 for calling a global function with example usage: test_dtype_with_str() without return types