code: def test_auto_in_fmt(ipynb_py_R_file):
      nb = read(ipynb_py_R_file)
      auto_ext = auto_ext_from_metadata(nb.metadata)
      fmt = auto_ext[1:] + ":percent"
      text = writes(nb, "auto:percent")
  
      assert "auto" not in text
  
      nb2 = reads(text, fmt)
      assert nb2.metadata["jupytext"]["text_representation"][
          "extension"
      ]
      assert (
          nb2.metadata["jupytext"]["text_representation"]["format_name"]
          == "percent"
      )
  
      del nb.metadata["language_info"]
      del nb.metadata["kernelspec"]
      with pytest.raises(JupytextFormatError):
          writes(nb, "auto:percent")
  
imports: import pytest
  from jupytext import read, reads, writes
  from jupytext.formats import JupytextFormatError, auto_ext_from_metadata
label_desc: Use image node_id 1 for calling a global function with example usage: test_auto_in_fmt(ipynb_py_R_file) without return types