code: def test_to_from_file(df: pl.DataFrame, tmp_path: Path) -> None:
      tmp_path.mkdir(exist_ok=True)
  
      file_path = tmp_path / "small.json"
      df.write_json(file_path)
      out = pl.read_json(file_path)
  
      assert_frame_equal(df, out, categorical_as_str=True)
  
imports: from __future__ import annotations
  import datetime
  import io
  import json
  from collections import OrderedDict
  from io import BytesIO
  from typing import TYPE_CHECKING, Any
  import pytest
  import polars
  from polars.testing import assert_frame_equal
label_desc: Use image node_id 2 for calling a global function with example usage: test_to_from_file(df, tmp_path) without return types