code: def test_invalid_github_path():
      # Path are lazily validated, so require explicit `_metadata` call.
  
      with pytest.raises(ValueError, match="Invalid github path"):
          _ = github_path.GithubPath()._metadata
  
      with pytest.raises(ValueError, match="Invalid github path"):
          _ = github_path.GithubPath("")._metadata
  
      with pytest.raises(ValueError, match="Invalid github path"):
          _ = github_path.GithubPath("github://not/a/path")
  
      with pytest.raises(ValueError, match="Invalid github path"):
          _ = github_path.GithubPath(
              "github://tensorflow/tree/master/docs/README.md"
          )
  
      # `blob` isn't accepted for consistency between paths.
      with pytest.raises(ValueError, match="/blob/` isn't accepted."):
          _ = github_path.GithubPath(
              "github://tensorflow/datasets/blob/master/docs/README.md"
          )
  
      p = github_path.GithubPath(
          "github://tensorflow/datasets/tree/master/docs/README.md"
      )
      p = p.parent  # /docs
      _ = p._metadata
      p = p.parent  # /
      _ = p._metadata
      p = p.parent
      with pytest.raises(ValueError, match="Invalid github path"):
          _ = p._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 4 for calling a global function with example usage: test_invalid_github_path() without return types