Esempio n. 1
0
class TestCSSSelectorFactory(unittest.TestCase):
    def setUp(self):
        self.element_factory = ElementFactory()

    @mock.patch('xcrawler.core.extractor.element.Element')
    def test_create_element(self, mock_element_class):
        mock_tag = "div"
        mock_element_instance = mock.create_autospec(Element).return_value
        mock_element_class.return_value = mock_element_instance
        self.element_factory.create_element(mock_tag)
        mock_element_class.assert_called_once_with(mock_tag)
Esempio n. 2
0
class TestCSSSelectorFactory(unittest.TestCase):

    def setUp(self):
        self.element_factory = ElementFactory()

    @mock.patch('xcrawler.core.extractor.element.Element')
    def test_create_element(self, mock_element_class):
        mock_tag = "div"
        mock_element_instance = mock.create_autospec(Element).return_value
        mock_element_class.return_value = mock_element_instance
        self.element_factory.create_element(mock_tag)
        mock_element_class.assert_called_once_with(mock_tag)
Esempio n. 3
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. 4
0
 def setUp(self):
     self.element_factory = ElementFactory()
Esempio n. 5
0
 def setUp(self):
     self.element_factory = ElementFactory()