test_aiter.py — langchain Source File
Architecture documentation for test_aiter.py, a python file in the langchain codebase. 3 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 764f3343_e69e_a462_abb8_a6aab40df7f9["test_aiter.py"] 2bf6d401_816d_d011_3b05_a6114f55ff58["collections.abc"] 764f3343_e69e_a462_abb8_a6aab40df7f9 --> 2bf6d401_816d_d011_3b05_a6114f55ff58 f69d6389_263d_68a4_7fbf_f14c0602a9ba["pytest"] 764f3343_e69e_a462_abb8_a6aab40df7f9 --> f69d6389_263d_68a4_7fbf_f14c0602a9ba f1eef20e_f8a1_22aa_5a63_124220f7b6a9["langchain_core.utils.aiter"] 764f3343_e69e_a462_abb8_a6aab40df7f9 --> f1eef20e_f8a1_22aa_5a63_124220f7b6a9 style 764f3343_e69e_a462_abb8_a6aab40df7f9 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
from collections.abc import AsyncIterator
import pytest
from langchain_core.utils.aiter import abatch_iterate
@pytest.mark.parametrize(
("input_size", "input_iterable", "expected_output"),
[
(2, [1, 2, 3, 4, 5], [[1, 2], [3, 4], [5]]),
(3, [10, 20, 30, 40, 50], [[10, 20, 30], [40, 50]]),
(1, [100, 200, 300], [[100], [200], [300]]),
(4, [], []),
],
)
async def test_abatch_iterate(
input_size: int, input_iterable: list[str], expected_output: list[list[str]]
) -> None:
"""Test batching function."""
async def _to_async_iterable(iterable: list[str]) -> AsyncIterator[str]:
for item in iterable:
yield item
iterator_ = abatch_iterate(input_size, _to_async_iterable(input_iterable))
assert isinstance(iterator_, AsyncIterator)
output = [el async for el in iterator_]
assert output == expected_output
Domain
Subdomains
Functions
Dependencies
- collections.abc
- langchain_core.utils.aiter
- pytest
Source
Frequently Asked Questions
What does test_aiter.py do?
test_aiter.py is a source file in the langchain codebase, written in python. It belongs to the LangChainCore domain, MessageInterface subdomain.
What functions are defined in test_aiter.py?
test_aiter.py defines 1 function(s): test_abatch_iterate.
What does test_aiter.py depend on?
test_aiter.py imports 3 module(s): collections.abc, langchain_core.utils.aiter, pytest.
Where is test_aiter.py in the architecture?
test_aiter.py is located at libs/core/tests/unit_tests/utils/test_aiter.py (domain: LangChainCore, subdomain: MessageInterface, directory: libs/core/tests/unit_tests/utils).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free