Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
This commit is contained in:
Erick Friis
2023-10-25 11:06:58 -07:00
committed by GitHub
parent 07c2649753
commit 47070b8314
31 changed files with 5549 additions and 0 deletions

View File

View File

@@ -0,0 +1,32 @@
from langchain_cli.utils.git import _parse_dependency_string, DependencySource
from langchain_cli.constants import DEFAULT_GIT_REPO, DEFAULT_GIT_SUBDIRECTORY
def test_dependency_string() -> None:
assert _parse_dependency_string(
"git+ssh://git@github.com/efriis/myrepo.git"
) == DependencySource(
git="ssh://git@github.com/efriis/myrepo.git",
ref=None,
subdirectory=None,
)
assert _parse_dependency_string(
"git+https://github.com/efriis/myrepo.git#subdirectory=src"
) == DependencySource(
git="https://github.com/efriis/myrepo.git",
subdirectory="src",
ref=None,
)
assert _parse_dependency_string(
"git+ssh://git@github.com:efriis/myrepo.git#develop"
) == DependencySource(
git="ssh://git@github.com:efriis/myrepo.git", ref="develop", subdirectory=None
)
assert _parse_dependency_string("simple-pirate") == DependencySource(
git=DEFAULT_GIT_REPO,
subdirectory=f"{DEFAULT_GIT_SUBDIRECTORY}/simple-pirate",
ref=None,
)