mirror of
https://github.com/hwchase17/langchain
synced 2024-11-06 03:20:49 +00:00
47070b8314
Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
33 lines
1.0 KiB
Python
33 lines
1.0 KiB
Python
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,
|
|
)
|