Home / Function/ test_prevent_outside() — langchain Function Reference

test_prevent_outside() — langchain Function Reference

Architecture documentation for the test_prevent_outside() function in test_html.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  bf92d31b_2ea4_723b_3770_b15859546311["test_prevent_outside()"]
  89d29efc_3f6a_dceb_4c69_b201fa975bdd["test_html.py"]
  bf92d31b_2ea4_723b_3770_b15859546311 -->|defined in| 89d29efc_3f6a_dceb_4c69_b201fa975bdd
  style bf92d31b_2ea4_723b_3770_b15859546311 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/utils/test_html.py lines 161–185

def test_prevent_outside() -> None:
    """Test that prevent outside compares against full base URL."""
    html = (
        '<a href="https://foobar.comic.com">BAD</a>'
        '<a href="https://foobar.comic:9999">BAD</a>'
        '<a href="https://foobar.com:9999">BAD</a>'
        '<a href="http://foobar.com:9999/">BAD</a>'
        '<a href="https://foobar.com/OK">OK</a>'
        '<a href="http://foobar.com/BAD">BAD</a>'  # Change in scheme is not OK here
    )

    expected = sorted(
        [
            "https://foobar.com/OK",
        ]
    )
    actual = sorted(
        extract_sub_links(
            html,
            "https://foobar.com/hello/bill.html",
            base_url="https://foobar.com",
            prevent_outside=True,
        )
    )
    assert actual == expected

Domain

Subdomains

Frequently Asked Questions

What does test_prevent_outside() do?
test_prevent_outside() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/utils/test_html.py.
Where is test_prevent_outside() defined?
test_prevent_outside() is defined in libs/core/tests/unit_tests/utils/test_html.py at line 161.

Analyze Your Own Codebase

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

Try Supermodel Free