Esempio n. 1
0
 def __init__(self,
              instance_resolver=InstanceResolver(),
              html_parser_factory=HtmlParserFactory(),
              element_factory=ElementFactory()):
     self.instance_resolver = instance_resolver
     self.html_parser_factory = html_parser_factory
     self.element_factory = element_factory
Esempio n. 2
0
class TestHtmlParserFactory(unittest.TestCase):
    def setUp(self):
        self.html_parser_factory = HtmlParserFactory()

    @mock.patch('xcrawler.http.requests.html_parser.HTMLParser')
    def test_create_html_parser_unicode(self, mock_html_parser_class):
        mock_html_parser = mock.create_autospec(HTMLParser).return_value
        mock_html_parser_class.return_value = mock_html_parser
        result = self.html_parser_factory.create_html_parser_unicode()
        self.assertEquals(result, mock_html_parser)
Esempio n. 3
0
class TestHtmlParserFactory(unittest.TestCase):

    def setUp(self):
        self.html_parser_factory = HtmlParserFactory()

    @mock.patch('xcrawler.http.requests.html_parser.HTMLParser')
    def test_create_html_parser_unicode(self, mock_html_parser_class):
        mock_html_parser = mock.create_autospec(HTMLParser).return_value
        mock_html_parser_class.return_value = mock_html_parser
        result = self.html_parser_factory.create_html_parser_unicode()
        self.assertEquals(result, mock_html_parser)
Esempio n. 4
0
 def setUp(self):
     self.html_parser_factory = HtmlParserFactory()
Esempio n. 5
0
 def setUp(self):
     self.html_parser_factory = HtmlParserFactory()