예제 #1
0
def test_two():
    msg = "http://fi.wikipedia.org/wiki/DTMF"
    module_urltitle.init(bot)
    eq_(
        ("#channel", u"Title: DTMF on puhelinlaitteissa käytetty numeroiden äänitaajuusvalintatapa."),
        module_urltitle.handle_url(bot, None, "#channel", msg, msg),
    )
예제 #2
0
def test_eleven():
    msg = "http://en.wikipedia.org/wiki/Edison_Arantes_do_Nascimento"
    module_urltitle.init(bot)
    eq_(
        ("#channel", u"Title: Edson Arantes do Nascimento, better known as Pelé, is a retired Brazilian footballer."),
        module_urltitle.handle_url(bot, None, "#channel", msg, msg),
    )
예제 #3
0
def test_eleven():
    msg = 'http://en.wikipedia.org/wiki/Edison_Arantes_do_Nascimento'
    module_urltitle.init(bot)
    eq_((
        "#channel",
        u"Title: Edson Arantes do Nascimento, who is better known as Pelé, is a retired Brazilian footballer who is widely regarded to be the best football player of all time."
    ), module_urltitle.handle_url(bot, None, "#channel", msg, msg))
예제 #4
0
def test_wiki_en():
    msg = "http://en.wikipedia.org/wiki/IPhone"
    module_urltitle.init(bot)
    eq_((
        "#channel",
        "Title: The iPhone is a line of smartphones designed and marketed by Apple Inc."
    ), module_urltitle.handle_url(bot, None, "#channel", msg, msg))
예제 #5
0
def test_liveleak():
    regex = 'Title: (.*?) by (.*?) \[%s views - Jul-23-2013 - tags\: sword, cut, hand, watermelon, fail\]' % (
        views_str_regex)
    msg = 'http://www.liveleak.com/view?i=f8e_1374614129'
    module_urltitle.init(bot)
    check_re(regex,
             module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
예제 #6
0
def test_areena_tv():
    regex = u'Title: (.*?) \[%s - %s plays - %s( - exits in \d+ (weeks|days|hours|minutes))?\]' % (
        lengh_str_regex, views_str_regex, age_str_regex)
    msg = "http://areena.yle.fi/tv/1999860"
    module_urltitle.init(bot)
    check_re(regex,
             module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
예제 #7
0
def test_iltalehti():
    msg = "http://www.iltalehti.fi/ulkomaat/2013072917307393_ul.shtml"
    module_urltitle.init(bot)
    eq_(
        ("#channel", "Title: Saksassa syntyi jättivauva - yli kuusi kiloa!"),
        module_urltitle.handle_url(bot, None, "#channel", msg, msg),
    )
예제 #8
0
def test_iltasanomat():
    msg = "http://www.iltasanomat.fi/viihde/art-1288596309269.html"
    module_urltitle.init(bot)
    eq_(
        ("#channel", "Title: Muistatko Mari Sainion juontaman sarjan, josta sai palkinnoksi isdn-liittymän?"),
        module_urltitle.handle_url(bot, None, "#channel", msg, msg),
    )
예제 #9
0
def test_iltasanomat():
    msg = "http://www.iltasanomat.fi/viihde/art-1288596309269.html"
    module_urltitle.init(bot)
    eq_((
        "#channel",
        "Title: Muistatko Mari Sainion juontaman sarjan, josta sai palkinnoksi isdn-liittymän?"
    ), module_urltitle.handle_url(bot, None, "#channel", msg, msg))
예제 #10
0
def test_liveleak():
    regex = "Title: (.*?) by (.*?) \[%s views - Jul-23-2013 - tags\: sword, cut, hand, watermelon, fail\]" % (
        views_str_regex
    )
    msg = "http://www.liveleak.com/view?i=f8e_1374614129"
    module_urltitle.init(bot)
    check_re(regex, module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
예제 #11
0
def test_stackoverflow():
    msg = "http://stackoverflow.com/questions/6905508/python-search-html-document-for-capital-letters"
    module_urltitle.init(bot)
    eq_((
        "#channel",
        "Title: Python search HTML document for capital letters - 0pts - python/regex/coda/letters/capitalize"
    ), module_urltitle.handle_url(bot, None, "#channel", msg, msg))
예제 #12
0
def test_verkkokauppacom():
    msg = "http://www.verkkokauppa.com/fi/product/34214/dkqht/Sony-NEX-3N-mikrojarjestelmakamera-16-50-mm-objektiivi-musta"
    module_urltitle.init(bot)
    eq_((
        "#channel",
        "Title: Sony NEX-3N mikrojärjestelmäkamera + 16-50 mm objektiivi, musta. | 369,90 € (heti)"
    ), module_urltitle.handle_url(bot, None, "#channel", msg, msg))
예제 #13
0
def test_seven():
    msg = "http://en.wikipedia.org/wiki/Ramon_Llull"
    module_urltitle.init(bot)
    eq_(
        ("#channel", u"Title: Ramon Llull was a Majorcan writer and philosopher, logician and a Franciscan tertiary."),
        module_urltitle.handle_url(bot, None, "#channel", msg, msg),
    )
예제 #14
0
def test_six():
    msg = "http://fi.wikipedia.org/wiki/Birger_Ek"
    module_urltitle.init(bot)
    eq_(
        ("#channel", u"Title: Rolf Birger Ek oli suomalainen lentäjä ja Mannerheim-ristin ritari."),
        module_urltitle.handle_url(bot, None, "#channel", msg, msg),
    )
예제 #15
0
def test_wiki_fi():
    msg = "http://fi.wikipedia.org/wiki/Kimi_Räikkönen"
    module_urltitle.init(bot)
    eq_((
        "#channel",
        "Title: Kimi-Matias Räikkönen on suomalainen autourheilija ja Formula 1:n maailmanmestari."
    ), module_urltitle.handle_url(bot, None, "#channel", msg, msg))
예제 #16
0
def test_wiki_en():
    msg = "http://en.wikipedia.org/wiki/IPhone"
    module_urltitle.init(bot)
    eq_(
        ("#channel", "Title: iPhone is a line of smartphones designed and marketed by Apple Inc."),
        module_urltitle.handle_url(bot, None, "#channel", msg, msg),
    )
예제 #17
0
def test_wiki_fi():
    msg = "http://fi.wikipedia.org/wiki/Kimi_Räikkönen"
    module_urltitle.init(bot)
    eq_(
        ("#channel", "Title: Kimi-Matias Räikkönen on suomalainen autourheilija ja Formula 1:n maailmanmestari."),
        module_urltitle.handle_url(bot, None, "#channel", msg, msg),
    )
예제 #18
0
def test_ten():
    msg = 'http://en.wikipedia.org/wiki/802.11ac'
    module_urltitle.init(bot)
    eq_((
        "#channel",
        u"Title: IEEE 802.11ac is a wireless networking standard in the 802.11 family, developed in the IEEE Standards Association process, providing high-throughput wireless local area networks on the 5\xa0GHz band."
    ), module_urltitle.handle_url(bot, None, "#channel", msg, msg))
예제 #19
0
def test_one():
    msg = "https://en.wikipedia.org/wiki/Hatfield–McCoy_feud"
    module_urltitle.init(bot)
    eq_((
        "#channel",
        u"Title: The Hatfield–McCoy feud involved two families of the West Virginia–Kentucky area along the Tug Fork of the Big Sandy River."
    ), module_urltitle.handle_url(bot, None, "#channel", msg, msg))
예제 #20
0
def test_areena_series():
    regex = u'Title: (.*?) \[SERIES - \d+ episodes - latest episode: %s\]' % (
        age_str_regex)
    msg = "http://areena.yle.fi/tv/2129619"
    module_urltitle.init(bot)
    check_re(regex,
             module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
예제 #21
0
def test_seven():
    msg = "http://en.wikipedia.org/wiki/Ramon_Llull"
    module_urltitle.init(bot)
    eq_((
        "#channel",
        u"Title: Ramon Llull, T.O.S.F. was a Majorcan writer and philosopher, logician and a Franciscan tertiary."
    ), module_urltitle.handle_url(bot, None, "#channel", msg, msg))
예제 #22
0
def test_eight():
    msg = "http://en.wikipedia.org/wiki/Lazarus_of_Bethany#In_culture"
    module_urltitle.init(bot)
    eq_((
        "#channel",
        u"Title: Lazarus of Bethany, also known as Saint Lazarus or Lazarus of the Four Days, is the subject of a prominent miracle attributed to Jesus in the Gospel of John, in which Jesus restores him to life four d..."
    ), module_urltitle.handle_url(bot, None, "#channel", msg, msg))
예제 #23
0
def test_five():
    msg = "http://fi.wikipedia.org/wiki/David_Eddings"
    module_urltitle.init(bot)
    eq_((
        "#channel",
        u"Title: David Carroll Eddings oli yhdysvaltalainen kirjailija, joka kirjoitti useita suosittuja fantasiakirjoja."
    ), module_urltitle.handle_url(bot, None, "#channel", msg, msg))
예제 #24
0
def test_six():
    msg = "http://fi.wikipedia.org/wiki/Birger_Ek"
    module_urltitle.init(bot)
    eq_((
        "#channel",
        u"Title: Rolf Birger Ek oli suomalainen lentäjä ja Mannerheim-ristin ritari."
    ), module_urltitle.handle_url(bot, None, "#channel", msg, msg))
예제 #25
0
def test_four():
    msg = "http://en.wikipedia.org/wiki/Dynamo_(magician)"
    module_urltitle.init(bot)
    eq_((
        "#channel",
        u"Title: Steven Frayne, commonly known by his stage name \"Dynamo\", is an English magician, best known for his show Dynamo: Magician Impossible."
    ), module_urltitle.handle_url(bot, None, "#channel", msg, msg))
예제 #26
0
def test_three():
    msg = "http://en.wikipedia.org/wiki/Gender_performativity"
    module_urltitle.init(bot)
    eq_((
        "#channel",
        u"Title: Gender performativity is a term created by post-structuralist feminist philosopher Judith Butler in her 1990 book Gender Trouble, which has subsequently been used in a variety of academic fields."
    ), module_urltitle.handle_url(bot, None, "#channel", msg, msg))
예제 #27
0
def test_two():
    msg = "http://fi.wikipedia.org/wiki/DTMF"
    module_urltitle.init(bot)
    eq_((
        "#channel",
        u"Title: DTMF on puhelinlaitteissa käytetty numeroiden äänitaajuusvalintatapa."
    ), module_urltitle.handle_url(bot, None, "#channel", msg, msg))
예제 #28
0
def test_google_play_music():
    msg = 'https://play.google.com/music/m/Tkyqfh5koeirtbi76b2tsee6e2y'
    module_urltitle.init(bot)
    responses = [('#channel', 'Title: Villiviini - Ultra Bra'), None]
    ok_(
        module_urltitle.handle_url(bot, None, "#channel", msg, msg) in
        responses)
예제 #29
0
def test_youtube():
    regex = "Title: (.*?) by (.*?) \[%s - %s views - %s( - age restricted)?\]" % (
        lengh_str_regex,
        views_str_regex,
        age_str_regex,
    )
    msg = "http://www.youtube.com/watch?v=awsolTK175c"
    module_urltitle.init(bot)
    check_re(regex, module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
예제 #30
0
def test_youtube(botmock):
    regex = "Title: (.*?) by (.*?) \[%s - %s views - %s( - age restricted)?\]" % (
        lengh_str_regex,
        views_str_regex,
        age_str_regex,
    )
    msg = "http://www.youtube.com/watch?v=awsolTK175c"
    module_urltitle.init(botmock)
    check_re(regex, __handle_url(botmock, msg))
예제 #31
0
def test_stackoverflow():
    msg = "http://stackoverflow.com/questions/6905508/python-search-html-document-for-capital-letters"
    module_urltitle.init(bot)
    eq_(
        (
            "#channel",
            "Title: Python search HTML document for capital letters - 0pts - python/regex/coda/letters/capitalize",
        ),
        module_urltitle.handle_url(bot, None, "#channel", msg, msg),
    )
예제 #32
0
def test_three():
    msg = "http://en.wikipedia.org/wiki/Gender_performativity"
    module_urltitle.init(bot)
    eq_(
        (
            "#channel",
            u"Title: Gender performativity is a term created by post-structuralist feminist philosopher Judith Butler in her 1990 book Gender Trouble, which has subsequently been used in a variety of academic fields.",
        ),
        module_urltitle.handle_url(bot, None, "#channel", msg, msg),
    )
예제 #33
0
def test_four():
    msg = "http://en.wikipedia.org/wiki/Dynamo_(magician)"
    module_urltitle.init(bot)
    eq_(
        (
            "#channel",
            u"Title: Dynamo is an English magician, best known for his fly on the wall documentary show Dynamo: Magician Impossible.",
        ),
        module_urltitle.handle_url(bot, None, "#channel", msg, msg),
    )
예제 #34
0
def test_eight():
    msg = "http://en.wikipedia.org/wiki/Lazarus_of_Bethany#In_culture"
    module_urltitle.init(bot)
    eq_(
        (
            "#channel",
            u"Title: Lazarus of Bethany, also known as Saint Lazarus or Lazarus of the Four Days, is the subject of a prominent miracle attributed to Jesus in the Gospel of John, in which Jesus restores him to life four d...",
        ),
        module_urltitle.handle_url(bot, None, "#channel", msg, msg),
    )
예제 #35
0
def test_five():
    msg = "http://fi.wikipedia.org/wiki/David_Eddings"
    module_urltitle.init(bot)
    eq_(
        (
            "#channel",
            u"Title: David Carroll Eddings oli yhdysvaltalainen kirjailija, joka kirjoitti useita suosittuja fantasiakirjoja.",
        ),
        module_urltitle.handle_url(bot, None, "#channel", msg, msg),
    )
예제 #36
0
def test_vimeo():
    regex = "Title: (.*?) by (.*?) \[%s - %s likes - %s views - %s]" % (
        lengh_str_regex,
        views_str_regex,
        views_str_regex,
        age_str_regex,
    )
    msg = "http://vimeo.com/29996808"
    module_urltitle.init(bot)
    check_re(regex, module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
예제 #37
0
def test_ten():
    msg = "http://en.wikipedia.org/wiki/802.11ac"
    module_urltitle.init(bot)
    eq_(
        (
            "#channel",
            u"Title: IEEE 802.11ac is a wireless computer networking standard in the 802.11 family, developed in the IEEE Standards Association process, providing high-throughput wireless local area networks on the 5 GHz ...",
        ),
        module_urltitle.handle_url(bot, None, "#channel", msg, msg),
    )
예제 #38
0
def test_one():
    msg = "https://en.wikipedia.org/wiki/Hatfield–McCoy_feud"
    module_urltitle.init(bot)
    eq_(
        (
            "#channel",
            u"Title: The Hatfield–McCoy feud involved two families of the West Virginia–Kentucky area along the Tug Fork of the Big Sandy River.",
        ),
        module_urltitle.handle_url(bot, None, "#channel", msg, msg),
    )
예제 #39
0
def test_manual_ignore():
    msg = "- foofoo http://www.youtube.com/"
    module_urltitle.init(bot)
    eq_(None, module_urltitle.handle_url(bot, None, "#channel", msg, msg))
예제 #40
0
def test_spotify_ignore():
    msg = "http://open.spotify.com/artist/4tuiQRw9bC9HZhSFJEJ9Mz"
    module_urltitle.init(bot)
    eq_(None, module_urltitle.handle_url(bot, None, "#channel", msg, msg))
예제 #41
0
def test_poliisi():
    msg = 'http://www.poliisi.fi/poliisi/lappi14/home.nsf/PFBD/76D41E0F8B4A85E5C2257C760045DAC6'
    title = 'Title: Poliisi kaipaa ajoneuvoyhdistelmää kolaroinutta henkilöä'
    module_urltitle.init(bot)
    eq_(title, module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
예제 #42
0
def test_imdb_ignore():
    msg = "http://www.imdb.com/title/tt1772341/"
    module_urltitle.init(bot)
    eq_(None, module_urltitle.handle_url(bot, None, "#channel", msg, msg))
예제 #43
0
def test_alko():
    regex = 'Title: Sandels IV A tölkki \[\d\.\d\de, \d\.\d\dl, \d\.\d\de/l, oluet, 5\.30\%\]'
    msg = 'http://www.alko.fi/tuotteet/798684/'
    module_urltitle.init(bot)
    check_re(regex,
             module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
예제 #44
0
def test_dx():
    regex = 'Title: Wireless Bluetooth Audio Music Receiver Adapter - Black \[\d+\.\d+e - \[\** *\] - \d+ reviews\]'
    msg = 'http://dx.com/p/wireless-bluetooth-audio-music-receiver-adapter-black-151659'
    module_urltitle.init(bot)
    check_re(regex,
             module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
예제 #45
0
def test_areena_live():
    regex = u'Title: Yle TV2 - (.*?)( <http://areena.yle.fi/\d-\d+>)? \(LIVE\)'
    msg = "http://areena.yle.fi/tv/suora/tv2"
    module_urltitle.init(bot)
    check_re(regex, module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
예제 #46
0
def test_alko():
    regex = u'Title: Sandels IV A tölkki \[\d\.\d\de, \d\.\d\dl, \d\.\d\de/l, oluet, 5\.30\%\]'
    msg = 'http://www.alko.fi/tuotteet/798684/'
    module_urltitle.init(bot)
    check_re(regex, module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
예제 #47
0
def test_dx():
    regex = u'Title: Wireless Bluetooth Audio Music Receiver Adapter - Black \[\d+\.\d+e - \[\** *\] - \d+ reviews\]'
    msg = 'http://dx.com/p/wireless-bluetooth-audio-music-receiver-adapter-black-151659'
    module_urltitle.init(bot)
    check_re(regex, module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
예제 #48
0
def test_verkkokauppacom():
    msg = "http://www.verkkokauppa.com/fi/product/34214/dkqht/Sony-NEX-3N-mikrojarjestelmakamera-16-50-mm-objektiivi-musta"
    module_urltitle.init(bot)
    eq_(("#channel", u"Title: Sony NEX-3N mikrojärjestelmäkamera + 16-50 mm objektiivi, musta. | 369,90 € (heti)"), module_urltitle.handle_url(bot, None, "#channel", msg, msg))
예제 #49
0
def test_manual_ignore():
    msg = "- foofoo http://www.youtube.com/"
    module_urltitle.init(bot)
    eq_(None, module_urltitle.handle_url(bot, None, "#channel", msg, msg))
예제 #50
0
def test_spotify_ignore():
    msg = "http://open.spotify.com/artist/4tuiQRw9bC9HZhSFJEJ9Mz"
    module_urltitle.init(bot)
    eq_(None, module_urltitle.handle_url(bot, None, "#channel", msg, msg))
예제 #51
0
def test_imdb_ignore():
    msg = "http://www.imdb.com/title/tt1772341/"
    module_urltitle.init(bot)
    eq_(None, module_urltitle.handle_url(bot, None, "#channel", msg, msg))
예제 #52
0
def test_iltalehti():
    msg = "http://www.iltalehti.fi/ulkomaat/2013072917307393_ul.shtml"
    module_urltitle.init(bot)
    eq_(("#channel", "Title: Saksassa syntyi jättivauva - yli kuusi kiloa!"),
        module_urltitle.handle_url(bot, None, "#channel", msg, msg))
예제 #53
0
def test_areena_tv():
    regex = u'Title: (.*?) \[%s - %s plays - %s( - exits in \d+ (weeks|days|hours|minutes))?\]' % (lengh_str_regex, views_str_regex, age_str_regex)
    msg = "http://areena.yle.fi/1-1999860"
    module_urltitle.init(bot)
    check_re(regex, module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
예제 #54
0
def test_areena_series():
    regex = u'Title: (.*?) \[SERIES - \d+ episodes - latest episode: %s\]' % (age_str_regex)
    msg = "http://areena.yle.fi/1-2540167"
    module_urltitle.init(bot)
    check_re(regex, module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
예제 #55
0
def botmock():
    bot = bot_mock.BotMock()
    module_urltitle.init(bot)
    return bot
예제 #56
0
def test_four():
    msg = "http://en.wikipedia.org/wiki/Dynamo_(magician)"
    module_urltitle.init(bot)
    eq_(("#channel", u"Title: Steven Frayne, commonly known by his stage name \"Dynamo\", is an English magician, best known for his show Dynamo: Magician Impossible."), module_urltitle.handle_url(bot, None, "#channel", msg, msg))
예제 #57
0
def test_ebay_cgi():
    msg = 'http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=121136837564'
    regex = 'Title: .*? \[\d+\.\de - over \d+ available - ships from .*?\]'
    module_urltitle.init(bot)
    check_re(regex,
             module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])
예제 #58
0
def test_youtube():
    regex = 'Title: (.*?) by (.*?) \[%s - \[\**\] - %s views - %s( - XXX)?\]' % (lengh_str_regex, views_str_regex, age_str_regex)
    msg = "http://www.youtube.com/watch?v=awsolTK175c"
    module_urltitle.init(bot)
    assert check_re(regex, module_urltitle.handle_url(bot, None, "#channel", msg, msg)[1])