예제 #1
0
def test_message_does_not_have_a_url():
    text = "foo <htts://no_url_example.org>"
    assert mess.extract_url(text) is None
예제 #2
0
def test_basic_url_detection_of_https():
    expected = "https://example.org"
    text = "foo <https://example.org>"
    assert mess.extract_url(text) == expected
예제 #3
0
def test_detection_of_http_in_the_middle():
    expected = "http://example.com"
    text = "foo <http://example.com> bar"
    assert mess.extract_url(text) == expected
예제 #4
0
def test_hyphen_in_url():
    expected = "https://this-is-a-test.org"
    text = "<https://this-is-a-test.org>"
    assert mess.extract_url(text) == expected
예제 #5
0
def test_underscore_in_url():
    expected = "https://this_website.org"
    text = "<https://this_website.org>"
    assert mess.extract_url(text) == expected
예제 #6
0
def test_and_in_url():
    expected = "http://example.org?foo=1&bar=2"
    text = "<http://example.org?foo=1&bar=2>"
    assert mess.extract_url(text) == expected
예제 #7
0
def test_qmark_in_url():
    expected = "http://example.org?"
    text = "<http://example.org?>"
    assert mess.extract_url(text) == expected
예제 #8
0
def test_equal_in_url():
    expected = "http://example.org?q=foo"
    text = "<http://example.org?q=foo>"
    assert mess.extract_url(text) == expected
예제 #9
0
def test_plus_in_url():
    expected = "http://foo.org/foo+bar"
    text = "<http://foo.org/foo+bar>"
    assert mess.extract_url(text) == expected
예제 #10
0
def test_hash_in_url():
    expected = "https://foo.org#bar"
    text = "<https://foo.org#bar>"
    assert mess.extract_url(text) == expected