code: def test_string_builder_append():
      sbuilder = StringBuilder()
      sbuilder.append(b"a byte string")
      sbuilder.append("a string")
      sbuilder.append(np.nan)
      sbuilder.append(None)
      assert len(sbuilder) == 4
      assert sbuilder.null_count == 2
      arr = sbuilder.finish()
      assert len(sbuilder) == 0
      assert isinstance(arr, pa.Array)
      assert arr.null_count == 2
      assert arr.type == "str"
      expected = ["a byte string", "a string", None, None]
      assert arr.to_pylist() == expected
  
file_path: arrow/python/pyarrow/tests/test_builder.py
imports: import weakref
  import numpy
  import pyarrow
  from pyarrow.lib import StringBuilder
label_desc: Use image node_id 2 for calling a global function with example usage: test_string_builder_append() without return types