code: def test_get_tree():
      tree = {
          "tree": [
              {
                  "path": "code1.py",
                  "type": "blob",
              },
              {
                  "path": "myfolder",
                  "type": "tree",
              },
              {
                  "path": "myfolder/code2.py",
                  "type": "blob",
              },
              {
                  "path": "myfolder/mysubfolder",
                  "type": "tree",
              },
              {
                  "path": "myfolder/mysubfolder/code3.py",
                  "type": "blob",
              },
          ]
      }
      with mock.patch.object(
          github_path.GithubApi, "query", return_value=tree
      ):
          root = github_path.GithubPath.from_repo(
              "tensorflow/datasets", "v9.9.9"
          )
  
          def gh_path(file: str) -> github_path.GithubPath:
              return github_path.GithubPath(
                  f"github://tensorflow/datasets/tree/v9.9.9/{file}"
              )
  
          def assert_is_file(file):
              assert file.is_file()
              assert not file.is_dir()
              assert file.exists()
  
          def assert_is_folder(folder, files):
              assert set(folder.iterdir()) == files
              assert folder.is_dir()
              assert not folder.is_file()
              assert folder.exists()
  
          myfolder = gh_path("myfolder")
          mysubfolder = gh_path("myfolder/mysubfolder")
          code1 = gh_path("code1.py")
          code2 = gh_path("myfolder/code2.py")
          code3 = gh_path("myfolder/mysubfolder/code3.py")
  
          assert_is_folder(root, {code1, myfolder})
          assert_is_folder(myfolder, {code2, mysubfolder})
          assert_is_folder(mysubfolder, {code3})
  
          assert_is_file(code1)
          assert_is_file(code2)
          assert_is_file(code3)
  
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 12 for calling a global function with example usage: test_get_tree() and returns: github_path