MCPcopy
hub / github.com/scrapy/scrapy / test_selector_shortcuts

Method test_selector_shortcuts

tests/test_http_response_text.py:244–255  ·  tests/test_http_response_text.py::TestTextResponse.test_selector_shortcuts
(self)

Source from the content-addressed store, hash-verified

242 assert response.selector.re(class="st">"Some (.*)</title>") == [class="st">"page"]
243
244 def test_selector_shortcuts(self):
245 body = bclass="st">"<html><head><title>Some page</title><body></body></html>"
246 response = self.response_class(class="st">"http://www.example.com", body=body)
247
248 assert (
249 response.xpath(class="st">"//title/text()").getall()
250 == response.selector.xpath(class="st">"//title/text()").getall()
251 )
252 assert (
253 response.css(class="st">"title::text").getall()
254 == response.selector.css(class="st">"title::text").getall()
255 )
256
257 def test_selector_shortcuts_kwargs(self):
258 body = b&class="cm">#x27;<html><head><title>Some page</title><body><p class=class="st">"content">A nice paragraph.</p></body></html>'

Callers

nothing calls this directly

Calls 2

xpathMethod · 0.45
cssMethod · 0.45

Tested by

no test coverage detected