Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(13)  |  Call(9)  |  Derive(0)  |  Import(4)

        def get_fixture(filename):
    cwd = os.path.dirname(os.path.abspath(__file__))
    fixture = os.path.join(cwd, 'fixtures', filename)
    with open(fixture) as fp:
        return fp.read()
        


src/p/y/pyoembed-0.1/pyoembed/tests/providers/test_autodiscover.py   pyoembed(Download)
from pyoembed.exceptions import ProviderException
from pyoembed.providers.autodiscover import AutoDiscoverProvider
from pyoembed.tests import get_fixture
 
 
    def test_oembed_url_request_failed(self, get):
        get.return_value = response = mock.Mock()
        response.ok = False
        response.text = get_fixture('autodiscover-both.html')
        with self.assertRaises(ProviderException):
    def test_oembed_url_none(self, get):
        get.return_value = response = mock.Mock()
        response.ok = True
        response.text = get_fixture('autodiscover-none.html')
        with self.assertRaises(ProviderException):
    def test_oembed_url_both(self, get):
        get.return_value = response = mock.Mock()
        response.ok = True
        response.text = get_fixture('autodiscover-both.html')
        self.assertEqual(self.provider.oembed_url(self.url),
    def test_oembed_url_json(self, get):
        get.return_value = response = mock.Mock()
        response.ok = True
        response.text = get_fixture('autodiscover-json.html')
        self.assertEqual(self.provider.oembed_url(self.url),

src/p/y/pyoembed-0.1/pyoembed/tests/parsers/test_xml_parser.py   pyoembed(Download)
import unittest
 
from pyoembed.parsers.xml_parser import XmlParser
from pyoembed.tests import get_fixture
 
    def test_content_parse(self):
        content = get_fixture('sample-video.xml')
        rv = self.parser.content_parse(content)
        self.assertEqual(rv, {'provider_url': 'http://www.youtube.com/',
                              'author_name': 'Showlivre',

src/p/y/pyoembed-0.1/pyoembed/tests/parsers/test_parsers.py   pyoembed(Download)
import unittest
 
from pyoembed.parsers.json_parser import JsonParser
from pyoembed.parsers.xml_parser import XmlParser
from pyoembed.tests import get_fixture
    def test_parsers_returns_same_stuff(self):
        xml_parser = XmlParser()
        json_parser = JsonParser()
        xml = xml_parser.content_parse(get_fixture('sample-video.xml'))
        json = json_parser.content_parse(get_fixture('sample-video.json'))

src/p/y/pyoembed-0.1/pyoembed/tests/parsers/test_json_parser.py   pyoembed(Download)
import unittest
 
from pyoembed.parsers.json_parser import JsonParser
from pyoembed.tests import get_fixture
 
    def test_content_parse(self):
        content = get_fixture('sample-video.json')
        rv = self.parser.content_parse(content)
        self.assertEqual(rv, {'provider_url': 'http://www.youtube.com/',
                              'author_name': 'Showlivre',