MCPcopy
hub / github.com/psf/requests-html / test_absolute_links

Function test_absolute_links

tests/test_requests_html.py:161–173  ·  view source on GitHub ↗
(url, link, expected)

Source from the content-addressed store, hash-verified

159 ('http://example.com/', '//xkcd.com/about/', 'http://xkcd.com/about/'),
160])
161def test_absolute_links(url, link, expected):
162 head_template = """<head><base href='{}'></head>"""
163 body_template = """<body><a href='{}'>Next</a></body>"""
164
165 # Test without `<base>` tag (url is base)
166 html = HTML(html=body_template.format(link), url=url)
167 assert html.absolute_links.pop() == expected
168
169 # Test with `<base>` tag (url is other)
170 html = HTML(
171 html=head_template.format(url) + body_template.format(link),
172 url='http://example.com/foobar/')
173 assert html.absolute_links.pop() == expected
174
175
176@pytest.mark.render

Callers

nothing calls this directly

Calls 1

HTMLClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…