| 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>' |