code: def test_json_string(builtin_pkg):
      assert utils.json_string(None, nan_display="nan") == "nan"
      assert utils.json_string("\u25B2") is not None
  
      class MockStr(object):
          def __init__(self, string=""):
              raise Exception("test")
  
      class MockLogger(object):
          def exception(self, v):
              pass
  
      with ExitStack() as stack:
          stack.enter_context(
              mock.patch(
                  "{}.str".format(builtin_pkg),
                  mock.Mock(side_effect=MockStr),
              )
          )
          stack.enter_context(
              mock.patch("dtale.utils.logger", MockLogger())
          )
          assert utils.json_string("blah", nan_display="nan") == "nan"
  
file_path: dtale/tests/dtale/test_utils.py
imports: from collections import namedtuple
  import mock
  import numpy
  import pandas
  import pytest
  from six import PY3
  import dtale.utils
  from tests import ExitStack
label_desc: Use image node_id 10 for calling a global function with example usage: test_json_string(builtin_pkg) without return types