コード例 #1
0
ファイル: test_pyfiurl.py プロジェクト: lepinkainen/pyfibot
def testTrailingSpaces():
    """Trailing spaces after URL"""
    assert ["http://tomtom.foobar.org/"] == grab(
        "http://tomtom.foobar.org/     ", needScheme
    )
    assert ["http://www.foobi.org/saatoimia"] == grab(
        "http://www.foobi.org/saatoimia    ", needScheme
    )
コード例 #2
0
ファイル: test_pyfiurl.py プロジェクト: lepinkainen/pyfibot
def testLeadingSpaces():
    """Leading spaces before URL"""
    assert ["http://tomtom.foobar.org/"] == grab(
        "     http://tomtom.foobar.org/", needScheme
    )
    assert ["http://www.foobi.org/saatoimia"] == grab(
        "  http://www.foobi.org/saatoimia", needScheme
    )
コード例 #3
0
ファイル: test_pyfiurl.py プロジェクト: lepinkainen/pyfibot
def testIPv6noscheme():
    """IPv6 URL without a scheme"""
    if needScheme:
        return
    assert ["[2001:a68:104:1337:250:daff:fe72:871c]/toimia"] == grab(
        "foo [2001:a68:104:1337:250:daff:fe72:871c]/toimia", needScheme
    )
コード例 #4
0
def testIPv6noscheme():
    """IPv6 URL without a scheme"""
    if needScheme:
        return
    assert ["[2001:a68:104:1337:250:daff:fe72:871c]/toimia"
            ] == grab("foo [2001:a68:104:1337:250:daff:fe72:871c]/toimia",
                      needScheme)
コード例 #5
0
def testScandinavian():
    """Test åäö"""
    assert [
        "http://www.hs.fi/kotimaa/artikkeli/Äidin+avovaimosta+lapsen+toinen+huoltaja+KKOn+päätöksellä/1135253379084"
    ] == grab(
        "http://www.hs.fi/kotimaa/artikkeli/Äidin+avovaimosta+lapsen+toinen+huoltaja+KKOn+päätöksellä/1135253379084",
        needScheme,
    )
コード例 #6
0
ファイル: test_pyfiurl.py プロジェクト: lepinkainen/pyfibot
def testScandinavian():
    """Test åäö"""
    assert [
        "http://www.hs.fi/kotimaa/artikkeli/Äidin+avovaimosta+lapsen+toinen+huoltaja+KKOn+päätöksellä/1135253379084"
    ] == grab(
        "http://www.hs.fi/kotimaa/artikkeli/Äidin+avovaimosta+lapsen+toinen+huoltaja+KKOn+päätöksellä/1135253379084",
        needScheme,
    )
コード例 #7
0
ファイル: test_pyfiurl.py プロジェクト: SriRamanujam/pyfibot
def testBlocks():
    """Test blocks"""
    assert [
            'http://link1.com',
            'http://link2.com',
            'http://link3.com',
            'http://link4.com',
            'http://link5.com',
    ] == grab('(http://link1.com) <http://link2.com> "http://link3.com" \'http://link4.com\' [http://link5.com]', needScheme)
コード例 #8
0
ファイル: test_pyfiurl.py プロジェクト: lepinkainen/pyfibot
def testRedirect():
    """Redirect URL"""
    assert [
        "http://rediretinmyurl.com/http://dest.url.org/1/2/3/4?434",
        "http://secondurl.com",
        "ftp://1.2.3.4/adsfasdf",
    ] == grab(
        "http://rediretinmyurl.com/http://dest.url.org/1/2/3/4?434 http://secondurl.com ftp://1.2.3.4/adsfasdf",
        needScheme,
    )
コード例 #9
0
def testRedirect():
    """Redirect URL"""
    assert [
        "http://rediretinmyurl.com/http://dest.url.org/1/2/3/4?434",
        "http://secondurl.com",
        "ftp://1.2.3.4/adsfasdf",
    ] == grab(
        "http://rediretinmyurl.com/http://dest.url.org/1/2/3/4?434 http://secondurl.com ftp://1.2.3.4/adsfasdf",
        needScheme,
    )
コード例 #10
0
ファイル: test_pyfiurl.py プロジェクト: lepinkainen/pyfibot
def testBlocks():
    """Test blocks"""
    assert [
        "http://link1.com",
        "http://link2.com",
        "http://link3.com",
        "http://link4.com",
        "http://link5.com",
    ] == grab(
        "(http://link1.com) <http://link2.com> \"http://link3.com\" 'http://link4.com' [http://link5.com]",
        needScheme,
    )
コード例 #11
0
def testBlocks():
    """Test blocks"""
    assert [
        "http://link1.com",
        "http://link2.com",
        "http://link3.com",
        "http://link4.com",
        "http://link5.com",
    ] == grab(
        "(http://link1.com) <http://link2.com> \"http://link3.com\" 'http://link4.com' [http://link5.com]",
        needScheme,
    )
コード例 #12
0
ファイル: test_pyfiurl.py プロジェクト: lepinkainen/pyfibot
def testLeadingText():
    """Leading text"""
    assert ["http://www.technikfoo.de/mai"] == grab(
        "here it is: http://www.technikfoo.de/mai", needScheme
    )
コード例 #13
0
ファイル: test_pyfiurl.py プロジェクト: lepinkainen/pyfibot
def testLeadingAndTrailingText():
    """Leading and trailing text"""
    assert ["http://123.123.123.123"] == grab(
        "fooasdf asdf a http://123.123.123.123 asdfasdf", needScheme
    )
コード例 #14
0
ファイル: test_pyfiurl.py プロジェクト: lepinkainen/pyfibot
def testLongURL():
    """A long URL-like string"""
    assert [] == grab(
        "www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www",
        needScheme,
    )
コード例 #15
0
ファイル: test_pyfiurl.py プロジェクト: lepinkainen/pyfibot
def testQuestionMarkURI():
    """An URI with a question mark"""
    assert ["http://www.bdog.fi/cgi-bin/netstore/tuotehaku.pl?tuoteryhma=16"] == grab(
        "http://www.bdog.fi/cgi-bin/netstore/tuotehaku.pl?tuoteryhma=16", needScheme
    )
コード例 #16
0
ファイル: test_pyfiurl.py プロジェクト: lepinkainen/pyfibot
def testIPv6():
    """IPv6 URL with scheme"""
    assert ["http://[2001:a68:104:1337:250:daff:fe72:871c]/toimia"] == grab(
        "foo http://[2001:a68:104:1337:250:daff:fe72:871c]/toimia", needScheme
    )
コード例 #17
0
def testIPv6():
    """IPv6 URL with scheme"""
    assert ["http://[2001:a68:104:1337:250:daff:fe72:871c]/toimia"] == grab(
        "foo http://[2001:a68:104:1337:250:daff:fe72:871c]/toimia", needScheme)
コード例 #18
0
ファイル: test_pyfiurl.py プロジェクト: lepinkainen/pyfibot
def testAnchor():
    """Link with an anchor tag"""
    assert ["http://foo.com/page.html#anchor"] == grab(
        "http://foo.com/page.html#anchor", needScheme
    )
コード例 #19
0
ファイル: test_pyfiurl.py プロジェクト: lepinkainen/pyfibot
def testFoobarIP():
    """ip number-like text"""
    assert [] == grab(
        "http://11123.123.123.123/eisaa http://123.123.123.12345/eisaa", needScheme
    )
コード例 #20
0
ファイル: test_pyfiurl.py プロジェクト: SriRamanujam/pyfibot
def testRedirect():
    """Redirect URL"""
    assert ['http://rediretinmyurl.com/http://dest.url.org/1/2/3/4?434', 'http://secondurl.com', 'ftp://1.2.3.4/adsfasdf'] == grab('http://rediretinmyurl.com/http://dest.url.org/1/2/3/4?434 http://secondurl.com ftp://1.2.3.4/adsfasdf', needScheme)
コード例 #21
0
def testLeadingText():
    """Leading text"""
    assert ["http://www.technikfoo.de/mai"
            ] == grab("here it is: http://www.technikfoo.de/mai", needScheme)
コード例 #22
0
def testLeadingSpaces():
    """Leading spaces before URL"""
    assert ["http://tomtom.foobar.org/"
            ] == grab("     http://tomtom.foobar.org/", needScheme)
    assert ["http://www.foobi.org/saatoimia"
            ] == grab("  http://www.foobi.org/saatoimia", needScheme)
コード例 #23
0
def testNoScheme():
    """URI without a scheme"""
    if needScheme:
        return
    assert ["123.123.123.123"] == grab("123.123.123.123", needScheme)
コード例 #24
0
def testLeadingAndTrailingText():
    """Leading and trailing text"""
    assert ["http://123.123.123.123"
            ] == grab("fooasdf asdf a http://123.123.123.123 asdfasdf",
                      needScheme)
コード例 #25
0
ファイル: test_pyfiurl.py プロジェクト: lepinkainen/pyfibot
def testIP():
    """http URI with an ip number"""
    assert ["http://234.234.234.234"] == grab("http://234.234.234.234", needScheme)
コード例 #26
0
def testQuestionMarkURI():
    """An URI with a question mark"""
    assert [
        "http://www.bdog.fi/cgi-bin/netstore/tuotehaku.pl?tuoteryhma=16"
    ] == grab("http://www.bdog.fi/cgi-bin/netstore/tuotehaku.pl?tuoteryhma=16",
              needScheme)
コード例 #27
0
def testTrailingSpaces():
    """Trailing spaces after URL"""
    assert ["http://tomtom.foobar.org/"
            ] == grab("http://tomtom.foobar.org/     ", needScheme)
    assert ["http://www.foobi.org/saatoimia"
            ] == grab("http://www.foobi.org/saatoimia    ", needScheme)
コード例 #28
0
ファイル: test_pyfiurl.py プロジェクト: lepinkainen/pyfibot
def testNoScheme():
    """URI without a scheme"""
    if needScheme:
        return
    assert ["123.123.123.123"] == grab("123.123.123.123", needScheme)
コード例 #29
0
ファイル: test_pyfiurl.py プロジェクト: lepinkainen/pyfibot
def test2URIs():
    """2 URIs on same text"""
    assert ["http://foobar.fi/1234{}[]{}", "http://127.0.0.1/"] == grab(
        "http://foobar.fi/1234{}[]{} sadfljs dlfkjsd lf;asdf http://127.0.0.1/",
        needScheme,
    )
コード例 #30
0
def testFoobarIP():
    """ip number-like text"""
    assert [] == grab(
        "http://11123.123.123.123/eisaa http://123.123.123.12345/eisaa",
        needScheme)
コード例 #31
0
def testLongURL():
    """A long URL-like string"""
    assert [] == grab(
        "www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www",
        needScheme,
    )
コード例 #32
0
def test2URIs():
    """2 URIs on same text"""
    assert ["http://foobar.fi/1234{}[]{}", "http://127.0.0.1/"] == grab(
        "http://foobar.fi/1234{}[]{} sadfljs dlfkjsd lf;asdf http://127.0.0.1/",
        needScheme,
    )
コード例 #33
0
def testAnchor():
    """Link with an anchor tag"""
    assert ["http://foo.com/page.html#anchor"
            ] == grab("http://foo.com/page.html#anchor", needScheme)
コード例 #34
0
def testIP():
    """http URI with an ip number"""
    assert ["http://234.234.234.234"] == grab("http://234.234.234.234",
                                              needScheme)