MCPcopy Create free account
hub / github.com/HzaCode/OneCite / test_html_page

Method test_html_page

tests/test_pipeline_unit.py:305–323  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

303class TestIdentifierURLMetadata:
304
305 def test_html_page(self):
306 ident = IdentifierModule()
307 html = """
308 <html>
309 <head><title>My Very Long Paper Title - PDF Download</title></head>
310 <body>
311 <div class="authors">By Alice Smith, Bob Jones</div>
312 <p>Published 2021.</p>
313 </body>
314 </html>
315 """
316 with patch("onecite.pipeline.requests.get",
317 return_value=DummyResponse(content=html.encode(),
318 headers={"content-type": "text/html"})):
319 meta = ident._extract_metadata_from_url("https://example.com/page")
320
321 assert meta["title"] == "My Very Long Paper Title"
322 assert meta["year"] == 2021
323 assert "Alice Smith" in meta["author"]
324
325 def test_pdf_delegates_to_extractor(self):
326 ident = IdentifierModule()

Callers

nothing calls this directly

Calls 3

IdentifierModuleClass · 0.90
DummyResponseClass · 0.85

Tested by

no test coverage detected