示例#1
0
def test_url_stripping_main():
    eq(
        yturl.video_id_from_url(
            "http://www.youtube.com/watch?feature=player_embed&v=gEl6TXrkZnk"
        ),
        "gEl6TXrkZnk",
    )
示例#2
0
def test_video_id_from_url_unparseable(url):
    with assert_raises(yturl.VideoIDParserError):
        yturl.video_id_from_url(url)
示例#3
0
def test_video_id_from_url(url, expected):
    eq(yturl.video_id_from_url(url), expected)
示例#4
0
def test_url_stripping_short():
    eq(
        yturl.video_id_from_url("youtu.be/gEl6TXrkZnk#foo"),
        "gEl6TXrkZnk",
    )
示例#5
0
 def save_model(self, request, instance, form, change):
     instance.youtube_code = video_id_from_url(
         form.cleaned_data['youtube_code'])
     instance.save()
     form.save_m2m()
     return instance
示例#6
0
文件: tests.py 项目: genba/yturl
def test_url_stripping():
    eq_(yturl.video_id_from_url("http://www.youtube.com/watch?feature=player_embedded&v=gEl6TXrkZnk"), "gEl6TXrkZnk")
    eq_(yturl.video_id_from_url("youtu.be/gEl6TXrkZnk#foo"), "gEl6TXrkZnk")
示例#7
0
def test_video_id_parsed_from_url(video_id, url_format):
    '''
    That that video IDs are successfully parsed from URLs.
    '''
    url = url_format % video_id
    eq(yturl.video_id_from_url(url), video_id)
示例#8
0
def test_url_stripping_short():
    eq(
        yturl.video_id_from_url("youtu.be/gEl6TXrkZnk#foo"),
        "gEl6TXrkZnk",
    )
示例#9
0
def test_url_stripping_main():
    eq(
        yturl.video_id_from_url(
            "http://www.youtube.com/watch?feature=player_embed&v=gEl6TXrkZnk"),
        "gEl6TXrkZnk",
    )