Home / File/ test_base.py — langchain Source File

test_base.py — langchain Source File

Architecture documentation for test_base.py, a python file in the langchain codebase. 4 imports, 0 dependents.

File python CoreAbstractions RunnableInterface 4 imports 1 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  9e35134b_91d9_e1f3_6e38_795112a5c7da["test_base.py"]
  cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7["collections.abc"]
  9e35134b_91d9_e1f3_6e38_795112a5c7da --> cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7
  2a596110_eecb_6975_0f38_02fb4494758e["langchain_core.document_loaders"]
  9e35134b_91d9_e1f3_6e38_795112a5c7da --> 2a596110_eecb_6975_0f38_02fb4494758e
  c554676d_b731_47b2_a98f_c1c2d537c0aa["langchain_core.documents"]
  9e35134b_91d9_e1f3_6e38_795112a5c7da --> c554676d_b731_47b2_a98f_c1c2d537c0aa
  91721f45_4909_e489_8c1f_084f8bd87145["typing_extensions"]
  9e35134b_91d9_e1f3_6e38_795112a5c7da --> 91721f45_4909_e489_8c1f_084f8bd87145
  style 9e35134b_91d9_e1f3_6e38_795112a5c7da fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"""Test Base Schema of documents."""

from collections.abc import Iterator

from langchain_core.document_loaders import BaseBlobParser, Blob
from langchain_core.documents import Document
from typing_extensions import override


def test_base_blob_parser() -> None:
    """Verify that the eager method is hooked up to the lazy method by default."""

    class MyParser(BaseBlobParser):
        """A simple parser that returns a single document."""

        @override
        def lazy_parse(self, blob: Blob) -> Iterator[Document]:
            """Lazy parsing interface."""
            yield Document(
                page_content="foo",
            )

    parser = MyParser()

    assert isinstance(parser.lazy_parse(Blob(data="who?")), Iterator)

    # We're verifying that the eager method is hooked up to the lazy method by default.
    docs = parser.parse(Blob(data="who?"))
    assert len(docs) == 1
    assert docs[0].page_content == "foo"

Subdomains

Classes

Dependencies

  • collections.abc
  • langchain_core.document_loaders
  • langchain_core.documents
  • typing_extensions

Frequently Asked Questions

What does test_base.py do?
test_base.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, RunnableInterface subdomain.
What functions are defined in test_base.py?
test_base.py defines 1 function(s): test_base_blob_parser.
What does test_base.py depend on?
test_base.py imports 4 module(s): collections.abc, langchain_core.document_loaders, langchain_core.documents, typing_extensions.
Where is test_base.py in the architecture?
test_base.py is located at libs/langchain/tests/unit_tests/document_loaders/test_base.py (domain: CoreAbstractions, subdomain: RunnableInterface, directory: libs/langchain/tests/unit_tests/document_loaders).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free