code: def test_dict_to_json():
      """Test to_json
      - make certain the filename is deterministic
      - make certain the file contents match the data
      """
      data = _create_data_with_values(10)
      try:
          result1 = pipe(data, to_json)
          result2 = pipe(data, to_json)
          filename = result1["url"]
          output = pd.read_json(filename).to_dict(orient="records")
      finally:
          os.remove(filename)
  
      assert result1 == result2
      assert data == {"values": output}
  
file_path: altair/tests/utils/test_data.py
imports: import os
  import pytest
  import pandas
  from toolz import pipe
  from altair.utils.data import limit_rows, MaxRowsError, sample, to_values, to_json, to_csv
label_desc: Use image node_id 8 for calling a global function with example usage: test_dict_to_json() without return types