Пример #1
0
def test_find_doc_urls() -> None:
    matcher = DocUrlMatcher()
    strs = [
        f"See {doc_url('foo-bar')} for details.",
        f"See {doc_url('qux')}.",  # Don't capture trailing dot.
        f"See {doc_url('foo-bar')} and {doc_url('baz3')}",  # Multiple urls in string.
    ]
    assert matcher.find_doc_urls(strs) == {doc_url(slug) for slug in ["foo-bar", "baz3", "qux"]}
Пример #2
0
def test_slug_for_url(slug: str) -> None:
    assert get_doc_slug(doc_url(slug)) == slug
Пример #3
0
def test_slug_for_url(slug: str) -> None:
    assert DocUrlMatcher().slug_for_url(doc_url(slug)) == slug
Пример #4
0
def test_doc_url(monkeypatch) -> None:
    monkeypatch.setattr(docutil, "MAJOR_MINOR", "1.29")
    assert doc_url(
        "some-slug") == "https://www.pantsbuild.org/v1.29/docs/some-slug"