code: def test_github_api_exists():
      """Test query github API."""
      p = github_path.GithubPath.from_repo(
          "tensorflow/datasets", "v3.1.0"
      )
      with enable_api_call():
          assert p.exists()
          assert not (p / "unknown_dir").exists()
  
      readme = p / "README.md"
      core = p / "tensorflow_datasets" / "core"
      with enable_api_call():
          assert readme.is_file()
          assert core.is_dir()
  
      # Data should have been cached (no API calls required)
      assert not readme.is_dir()
      assert not core.is_file()
      assert readme.exists()
      assert core.exists()
      # Recreating a new Path reuse the cache
      readme_recreated = core.parent.parent / "README.md"
      assert readme_recreated.is_file()
      assert readme_recreated._metadata == readme._metadata
  
file_path: datasets/tensorflow_datasets/core/github_api/github_path_test.py
imports: import contextlib
  import os
  import textwrap
  from unittest import mock
  from etils import epath
  import pytest
  from tensorflow_datasets.core.github_api import github_path
label_desc: Use image node_id 8 for calling a global function with example usage: test_github_api_exists() without return types