code: def test_to_json_append_lines():
      # GH 35849
      # Test ValueError when lines is not True
      df = DataFrame({"col1": [1, 2], "col2": ["a", "b"]})
      msg = (
          r"mode='a' \(append\) is only supported when "
          "lines is True and orient is 'records'"
      )
      with pytest.raises(ValueError, match=msg):
          df.to_json(mode="a", lines=False, orient="records")
  
imports: from collections.abc import Iterator
  from io import StringIO
  from pathlib import Path
  import numpy
  import pytest
  import pandas
  from pandas import DataFrame, read_json
  import pandas._testing
  from pandas.io.json._json import JsonReader
label_desc: Use image node_id 24 for calling a global function with example usage: test_to_json_append_lines() without return types