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

Method test_selector_shortcuts

tests/test_http_response_text.py:244–255  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

242 assert response.selector.re("Some (.*)</title>") == ["page"]
243
244 def test_selector_shortcuts(self):
245 body = b"<html><head><title>Some page</title><body></body></html>"
246 response = self.response_class("http://www.example.com", body=body)
247
248 assert (
249 response.xpath("//title/text()").getall()
250 == response.selector.xpath("//title/text()").getall()
251 )
252 assert (
253 response.css("title::text").getall()
254 == response.selector.css("title::text").getall()
255 )
256
257 def test_selector_shortcuts_kwargs(self):
258 body = b'<html><head><title>Some page</title><body><p class="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