code: def test_read_json_from_file_string(fig1, fig_type_spec, fig_type):
      with tempfile.TemporaryDirectory() as dir_name:
          # Write json file
          path = os.path.join(dir_name, "fig1.json")
          with open(path, "w") as f:
              f.write(pio.to_json(fig1))
  
          # read json from file as string
          fig1_loaded = pio.read_json(path, output_type=fig_type_spec)
  
          # Check return type
          assert isinstance(fig1_loaded, fig_type)
  
          # Check loaded figure
          assert pio.to_json(fig1_loaded) == pio.to_json(fig1.to_dict())
  
imports: import plotly.graph_objs
  import plotly.io
  import pytest
  import plotly
  import json
  import os
  import tempfile
  from unittest.mock import MagicMock
  from pathlib import Path
label_desc: Use image node_id 13 for calling a global function with example usage: test_read_json_from_file_string(fig1, fig_type_spec, fig_type) without return types