code: def test_auto_from_kernelspecs_works(ipynb_file):
      nb = read(ipynb_file)
      language_info = nb.metadata.pop("language_info")
      expected_ext = language_info.get("file_extension")
      if not expected_ext:
          pytest.skip("No file_extension in language_info")
      if expected_ext == ".r":
          expected_ext = ".R"
      elif expected_ext == ".fs":
          expected_ext = ".fsx"
      auto_ext = auto_ext_from_metadata(nb.metadata)
      if auto_ext == ".sage":
          pytest.skip(
              "Sage notebooks have Python in their language_info metadata, see #727"
          )
      assert auto_ext == expected_ext
  
imports: import pytest
  from jupytext import read, reads, writes
  from jupytext.formats import JupytextFormatError, auto_ext_from_metadata
label_desc: Use image node_id 2 for calling a global function with example usage: test_auto_from_kernelspecs_works(ipynb_file) without return types