Home / File/ test_iter.py — langchain Source File

test_iter.py — langchain Source File

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

File python CoreAbstractions Serialization 2 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  27198e87_21eb_9fba_0bf9_98ae905fde11["test_iter.py"]
  120e2591_3e15_b895_72b6_cb26195e40a6["pytest"]
  27198e87_21eb_9fba_0bf9_98ae905fde11 --> 120e2591_3e15_b895_72b6_cb26195e40a6
  fb97a5dd_8baa_cbb1_1219_066aff1f076c["langchain_core.utils.iter"]
  27198e87_21eb_9fba_0bf9_98ae905fde11 --> fb97a5dd_8baa_cbb1_1219_066aff1f076c
  style 27198e87_21eb_9fba_0bf9_98ae905fde11 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import pytest

from langchain_core.utils.iter import batch_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, [], []),
    ],
)
def test_batch_iterate(
    input_size: int, input_iterable: list[str], expected_output: list[list[str]]
) -> None:
    """Test batching function."""
    assert list(batch_iterate(input_size, input_iterable)) == expected_output

Subdomains

Dependencies

  • langchain_core.utils.iter
  • pytest

Frequently Asked Questions

What does test_iter.py do?
test_iter.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, Serialization subdomain.
What functions are defined in test_iter.py?
test_iter.py defines 1 function(s): test_batch_iterate.
What does test_iter.py depend on?
test_iter.py imports 2 module(s): langchain_core.utils.iter, pytest.
Where is test_iter.py in the architecture?
test_iter.py is located at libs/core/tests/unit_tests/utils/test_iter.py (domain: CoreAbstractions, subdomain: Serialization, 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