mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-02 03:26:17 +00:00
committed by
GitHub
parent
451c90fefa
commit
a46a2b8bda
@@ -4,4 +4,3 @@ import pytest
|
||||
@pytest.mark.compile
|
||||
def test_placeholder() -> None:
|
||||
"""Used for compiling integration tests without running any real tests."""
|
||||
pass
|
||||
|
@@ -1,19 +1,17 @@
|
||||
# ruff: noqa: E402
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
pytest.importorskip("gritql")
|
||||
|
||||
import difflib
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from typer.testing import CliRunner
|
||||
|
||||
from langchain_cli.cli import app
|
||||
from tests.unit_tests.migrate.cli_runner.cases import before, expected
|
||||
from tests.unit_tests.migrate.cli_runner.folder import Folder
|
||||
|
||||
pytest.importorskip("gritql")
|
||||
|
||||
|
||||
def find_issue(current: Folder, expected: Folder) -> str:
|
||||
for current_file, expected_file in zip(current.files, expected.files):
|
||||
@@ -25,7 +23,7 @@ def find_issue(current: Folder, expected: Folder) -> str:
|
||||
)
|
||||
if isinstance(current_file, Folder) and isinstance(expected_file, Folder):
|
||||
return find_issue(current_file, expected_file)
|
||||
elif isinstance(current_file, Folder) or isinstance(expected_file, Folder):
|
||||
if isinstance(current_file, Folder) or isinstance(expected_file, Folder):
|
||||
return (
|
||||
f"One of the files is a "
|
||||
f"folder: {current_file.name} != {expected_file.name}"
|
||||
|
@@ -10,49 +10,45 @@ from langchain_cli.namespaces.migrate.generate.generic import (
|
||||
@pytest.mark.xfail(reason="Unknown reason")
|
||||
def test_create_json_agent_migration() -> None:
|
||||
"""Test the migration of create_json_agent from langchain to langchain_community."""
|
||||
with sup1():
|
||||
with sup2():
|
||||
raw_migrations = generate_simplified_migrations(
|
||||
from_package="langchain", to_package="langchain_community"
|
||||
)
|
||||
json_agent_migrations = [
|
||||
migration
|
||||
for migration in raw_migrations
|
||||
if "create_json_agent" in migration[0]
|
||||
]
|
||||
assert json_agent_migrations == [
|
||||
(
|
||||
"langchain.agents.create_json_agent",
|
||||
"langchain_community.agent_toolkits.create_json_agent",
|
||||
),
|
||||
(
|
||||
"langchain.agents.agent_toolkits.create_json_agent",
|
||||
"langchain_community.agent_toolkits.create_json_agent",
|
||||
),
|
||||
(
|
||||
"langchain.agents.agent_toolkits.json.base.create_json_agent",
|
||||
"langchain_community.agent_toolkits.create_json_agent",
|
||||
),
|
||||
]
|
||||
with sup1(), sup2():
|
||||
raw_migrations = generate_simplified_migrations(
|
||||
from_package="langchain", to_package="langchain_community"
|
||||
)
|
||||
json_agent_migrations = [
|
||||
migration
|
||||
for migration in raw_migrations
|
||||
if "create_json_agent" in migration[0]
|
||||
]
|
||||
assert json_agent_migrations == [
|
||||
(
|
||||
"langchain.agents.create_json_agent",
|
||||
"langchain_community.agent_toolkits.create_json_agent",
|
||||
),
|
||||
(
|
||||
"langchain.agents.agent_toolkits.create_json_agent",
|
||||
"langchain_community.agent_toolkits.create_json_agent",
|
||||
),
|
||||
(
|
||||
"langchain.agents.agent_toolkits.json.base.create_json_agent",
|
||||
"langchain_community.agent_toolkits.create_json_agent",
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.xfail(reason="Unknown reason")
|
||||
def test_create_single_store_retriever_db() -> None:
|
||||
"""Test migration from langchain to langchain_core"""
|
||||
with sup1():
|
||||
with sup2():
|
||||
raw_migrations = generate_simplified_migrations(
|
||||
from_package="langchain", to_package="langchain_core"
|
||||
)
|
||||
# SingleStore was an old name for VectorStoreRetriever
|
||||
single_store_migration = [
|
||||
migration
|
||||
for migration in raw_migrations
|
||||
if "SingleStore" in migration[0]
|
||||
]
|
||||
assert single_store_migration == [
|
||||
(
|
||||
"langchain.vectorstores.singlestoredb.SingleStoreDBRetriever",
|
||||
"langchain_core.vectorstores.VectorStoreRetriever",
|
||||
),
|
||||
]
|
||||
"""Test migration from langchain to langchain_core."""
|
||||
with sup1(), sup2():
|
||||
raw_migrations = generate_simplified_migrations(
|
||||
from_package="langchain", to_package="langchain_core"
|
||||
)
|
||||
# SingleStore was an old name for VectorStoreRetriever
|
||||
single_store_migration = [
|
||||
migration for migration in raw_migrations if "SingleStore" in migration[0]
|
||||
]
|
||||
assert single_store_migration == [
|
||||
(
|
||||
"langchain.vectorstores.singlestoredb.SingleStoreDBRetriever",
|
||||
"langchain_core.vectorstores.VectorStoreRetriever",
|
||||
),
|
||||
]
|
||||
|
Reference in New Issue
Block a user