Esempio n. 1
0
def test_no_links():
    sentence = "sentence with no links."
    stripped_sentence, link_page, description, span_start, span_end = processwiki.get_wikilinks(
        sentence)

    assert stripped_sentence == "sentence with no links."
    assert link_page == []
    assert span_start == []
    assert span_end == []
Esempio n. 2
0
def test_multilink_with_description():
    sentence = "sentence [[linking_page|with]] multiple link with [[linking_page|no]] description."
    stripped_sentence, link_page, description, span_start, span_end = processwiki.get_wikilinks(
        sentence)

    assert stripped_sentence == "sentence with multiple link with no description."
    assert link_page == ["linking_page", "linking_page"]
    assert span_start == [9, 33]
    assert span_end == [13, 35]
Esempio n. 3
0
def test_onelink_with_description():
    sentence = "sentence [[linking_page|with]] one link with description."
    stripped_sentence, link_page, description, span_start, span_end = processwiki.get_wikilinks(
        sentence)

    assert stripped_sentence == "sentence with one link with description."
    assert link_page == ["linking_page"]
    assert span_start == [9]
    assert span_end == [13]