Home / Function/ test_nan_and_inf_handling() — langchain Function Reference

test_nan_and_inf_handling() — langchain Function Reference

Architecture documentation for the test_nan_and_inf_handling() function in test_utils.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  01eeaf9a_12c5_da1f_89b0_486415b2bc2e["test_nan_and_inf_handling()"]
  43305d93_a58a_e7db_615b_b8a5a18284ab["TestCosineSimilarity"]
  01eeaf9a_12c5_da1f_89b0_486415b2bc2e -->|defined in| 43305d93_a58a_e7db_615b_b8a5a18284ab
  style 01eeaf9a_12c5_da1f_89b0_486415b2bc2e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/vectorstores/test_utils.py lines 112–118

    def test_nan_and_inf_handling(self) -> None:
        """Test that NaN and inf values are handled properly."""
        # Create vectors that would result in NaN/inf in similarity calculation
        x: list[list[float]] = [[0, 0]]  # Zero vector
        y: list[list[float]] = [[0, 0]]  # Zero vector
        with pytest.raises(ValueError, match="NaN values found"):
            _cosine_similarity(x, y)

Domain

Subdomains

Frequently Asked Questions

What does test_nan_and_inf_handling() do?
test_nan_and_inf_handling() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/vectorstores/test_utils.py.
Where is test_nan_and_inf_handling() defined?
test_nan_and_inf_handling() is defined in libs/core/tests/unit_tests/vectorstores/test_utils.py at line 112.

Analyze Your Own Codebase

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

Try Supermodel Free