Home / Function/ test_extract_sub_links() — langchain Function Reference

test_extract_sub_links() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/tests/unit_tests/utils/test_html.py lines 72–104

def test_extract_sub_links() -> None:
    html = (
        '<a href="https://foobar.com">one</a>'
        '<a href="http://baz.net">two</a>'
        '<a href="//foobar.com/hello">three</a>'
        '<a href="/how/are/you/doing">four</a>'
    )
    expected = sorted(
        [
            "https://foobar.com",
            "https://foobar.com/hello",
            "https://foobar.com/how/are/you/doing",
        ]
    )
    actual = sorted(extract_sub_links(html, "https://foobar.com"))
    assert actual == expected

    actual = extract_sub_links(html, "https://foobar.com/hello")
    expected = ["https://foobar.com/hello"]
    assert actual == expected

    actual = sorted(
        extract_sub_links(html, "https://foobar.com/hello", prevent_outside=False)
    )
    expected = sorted(
        [
            "https://foobar.com",
            "http://baz.net",
            "https://foobar.com/hello",
            "https://foobar.com/how/are/you/doing",
        ]
    )
    assert actual == expected

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free