From 7f2f2035101089183460ebda9d710e80ab6ad40f Mon Sep 17 00:00:00 2001 From: Mort Yao Date: Mon, 21 Jul 2014 03:17:30 +0200 Subject: [PATCH] fix tests --- src/you_get/common.py | 8 ++++---- tests/test.py | 40 ++++++++++++---------------------------- tests/test_common.py | 2 +- tests/test_util.py | 2 +- 4 files changed, 18 insertions(+), 34 deletions(-) diff --git a/src/you_get/common.py b/src/you_get/common.py index a7035bf5..5f5228f9 100644 --- a/src/you_get/common.py +++ b/src/you_get/common.py @@ -941,7 +941,7 @@ def url_to_module(url): 'baidu': baidu, 'bilibili': bilibili, 'blip': blip, - 'catfun':catfun, + 'catfun': catfun, 'cntv': cntv, 'cbs': cbs, 'coursera': coursera, @@ -961,8 +961,8 @@ def url_to_module(url): 'kankanews': bilibili, 'khanacademy': khan, 'ku6': ku6, - 'kugou':kugou, - 'kuwo':kuwo, + 'kugou': kugou, + 'kuwo': kuwo, 'letv': letv, 'magisto': magisto, 'miomio': miomio, @@ -974,7 +974,7 @@ def url_to_module(url): 'sina': sina, 'smgbb': bilibili, 'sohu': sohu, - 'songtaste':songtaste, + 'songtaste': songtaste, 'soundcloud': soundcloud, 'ted': ted, 'theplatform': theplatform, diff --git a/tests/test.py b/tests/test.py index 0d51f86e..97fa58dd 100644 --- a/tests/test.py +++ b/tests/test.py @@ -1,47 +1,31 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- import unittest from you_get import * -from you_get.extractor.__main__ import url_to_module - -def test_urls(urls): - for url in urls: - url_to_module(url)[0].download(url, info_only = True) +from you_get.extractors import * +from you_get.common import * class YouGetTests(unittest.TestCase): def test_freesound(self): - test_urls([ - "http://www.freesound.org/people/Corsica_S/sounds/184419/", - ]) + freesound.download("http://www.freesound.org/people/Corsica_S/sounds/184419/", info_only=True) def test_magisto(self): - test_urls([ - "http://www.magisto.com/album/video/f3x9AAQORAkfDnIFDA", - ]) + magisto.download("http://www.magisto.com/album/video/f3x9AAQORAkfDnIFDA", info_only=True) def test_mixcloud(self): - test_urls([ - "http://www.mixcloud.com/beatbopz/beat-bopz-disco-mix/", - "http://www.mixcloud.com/DJVadim/north-america-are-you-ready/", - ]) + mixcloud.download("http://www.mixcloud.com/beatbopz/beat-bopz-disco-mix/", info_only=True) + mixcloud.download("http://www.mixcloud.com/DJVadim/north-america-are-you-ready/", info_only=True) def test_ted(self): - test_urls([ - "http://www.ted.com/talks/jennifer_lin_improvs_piano_magic.html", - "http://www.ted.com/talks/derek_paravicini_and_adam_ockelford_in_the_key_of_genius.html", - ]) + ted.download("http://www.ted.com/talks/jennifer_lin_improvs_piano_magic.html", info_only=True) + ted.download("http://www.ted.com/talks/derek_paravicini_and_adam_ockelford_in_the_key_of_genius.html", info_only=True) def test_vimeo(self): - test_urls([ - "http://vimeo.com/56810854", - ]) + vimeo.download("http://vimeo.com/56810854", info_only=True) def test_youtube(self): - test_urls([ - "http://www.youtube.com/watch?v=pzKerr0JIPA", - "http://youtu.be/pzKerr0JIPA", - "http://www.youtube.com/attribution_link?u=/watch?v%3DldAKIzq7bvs%26feature%3Dshare" - ]) + youtube.download("http://www.youtube.com/watch?v=pzKerr0JIPA", info_only=True) + youtube.download("http://youtu.be/pzKerr0JIPA", info_only=True) + youtube.download("http://www.youtube.com/attribution_link?u=/watch?v%3DldAKIzq7bvs%26feature%3Dshare", info_only=True) diff --git a/tests/test_common.py b/tests/test_common.py index 5e97b77b..f1ef9262 100644 --- a/tests/test_common.py +++ b/tests/test_common.py @@ -2,7 +2,7 @@ import unittest -from you_get import * +from you_get.common import * class TestCommon(unittest.TestCase): diff --git a/tests/test_util.py b/tests/test_util.py index 0b7b0231..239083bc 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -2,7 +2,7 @@ import unittest -from you_get.util import * +from you_get.util.fs import * class TestUtil(unittest.TestCase): def test_legitimize(self):