(self)
| 47 | assert url == sel.root.base |
| 48 | |
| 49 | def test_flavor_detection(self): |
| 50 | text = b'<div><img src="a.jpg"><p>Hello</div>' |
| 51 | sel = Selector(XmlResponse("http://example.com", body=text, encoding="utf-8")) |
| 52 | assert sel.type == "xml" |
| 53 | assert sel.xpath("//div").getall() == [ |
| 54 | '<div><img src="a.jpg"><p>Hello</p></img></div>' |
| 55 | ] |
| 56 | |
| 57 | sel = Selector(HtmlResponse("http://example.com", body=text, encoding="utf-8")) |
| 58 | assert sel.type == "html" |
| 59 | assert sel.xpath("//div").getall() == [ |
| 60 | '<div><img src="a.jpg"><p>Hello</p></div>' |
| 61 | ] |
| 62 | |
| 63 | def test_http_header_encoding_precedence(self): |
| 64 | # '\xa3' = pound symbol in unicode |
nothing calls this directly
no test coverage detected