Files
langchain-python/libs/langchain/tests/unit_tests/_api/test_path.py
T
Eugene Yurtsev cadfce295f Deprecate PythonRepl tools and Pandas/Xorbits/Spark DataFrame/Python/CSV agents (#12427)
See discussion here:
https://github.com/langchain-ai/langchain/discussions/11680

The code is available for usage from langchain_experimental. The reason
for the deprecation is that the agents are relying on a Python REPL. The
code can only be run safely with appropriate sandboxing.

---------

Co-authored-by: Bagatur <baskaryan@gmail.com>
2023-10-27 14:16:42 -04:00

24 lines
730 B
Python

from pathlib import Path
from langchain._api import path
HERE = Path(__file__).parent
ROOT = HERE.parent.parent.parent
def test_as_import_path() -> None:
"""Test that the path is converted to a LangChain import path."""
# Verify that default paths are correct
assert path.PACKAGE_DIR == ROOT / "langchain"
# Verify that as import path works correctly
assert path.as_import_path(HERE, relative_to=ROOT) == "tests.unit_tests._api"
assert (
path.as_import_path(__file__, relative_to=ROOT)
== "tests.unit_tests._api.test_path"
)
assert (
path.as_import_path(__file__, suffix="create_agent", relative_to=ROOT)
== "tests.unit_tests._api.test_path.create_agent"
)