def test_get_page_url_notitle():
    input_url = (
        "https://en.wikipedia.org/w/index.php"
        "?title=User:AntiCompositeNumber/test_anticompositetools"
        "&diff=930066511&oldid=927923634&diffmode=source"
    )
    with pytest.raises(ValueError):
        citeinspector.get_page_url(input_url)
def test_get_page_url_page():
    page = "User:AntiCompositeNumber/test_anticompositetools"
    url = (
        "https://en.wikipedia.org/w/index.php?"
        "title=User:AntiCompositeNumber/test_anticompositetools"
    )
    out = citeinspector.get_page_url(page)
    assert out[0] == url
    assert out[1] == page
def test_get_page_url_w():
    input_url = (
        "https://en.wikipedia.org/w/index.php?"
        "title=User:AntiCompositeNumber/test_anticompositetools"
    )
    url = (
        "https://en.wikipedia.org/w/index.php?"
        "title=User:AntiCompositeNumber/test_anticompositetools"
    )

    assert citeinspector.get_page_url(input_url)[0] == url
def test_get_page_url_malformed():
    input_url = (
        "https://en.wikipedia.org/" "User:AntiCompositeNumber/test_anticompositetools"
    )
    with pytest.raises(ValueError):
        citeinspector.get_page_url(input_url)
def test_get_page_url_nonwiki():
    input_url = "http://example.com"
    with pytest.raises(ValueError):
        citeinspector.get_page_url(input_url)