Using template0 when creating map db to avoid utf8 bug.

Fixed test_new_archive to handle platform-specific HTML formatting from BeautifulSoup.
Bumped version to 0.16.1-beta.
This commit is contained in:
Roland 2025-11-18 16:31:03 -07:00
parent ee434b3fb8
commit 398542c946
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
3 changed files with 16 additions and 25 deletions

View file

@ -277,7 +277,7 @@ def test_get_domains(test_session, archive_factory):
@pytest.mark.asyncio
async def test_new_archive(test_session, fake_now):
async def test_new_archive(test_session, test_directory, fake_now):
singlefile, readability, screenshot = make_fake_archive_result()
fake_now(datetime(2000, 1, 1))
archive1 = await model_archive_result('https://example.com', singlefile, readability, screenshot)
@ -293,28 +293,19 @@ async def test_new_archive(test_session, fake_now):
assert archive1.domain is not None
# The actual files were dumped and read correctly. The HTML/JSON files are reformatted.
assert archive1.singlefile_path.read_text() == '''<html>
<!--
Page saved with SingleFile-->
<body>
<p>
test single-file
ジにてこちら
</p>
<title>
some title
</title>
</body>
</html>
'''
assert archive1.readability_path.read_text() == '''<html>
<body>
<p>
test readability content
</p>
</body>
</html>
'''
# Note: We check for content presence rather than exact formatting because BeautifulSoup's
# prettify() can produce different output on different platforms (Mac vs CI).
singlefile_text = archive1.singlefile_path.read_text()
assert 'Page saved with SingleFile' in singlefile_text
assert 'test single-file' in singlefile_text
assert 'ジにてこちら' in singlefile_text
assert '<title>' in singlefile_text
assert 'some title' in singlefile_text
assert singlefile_text.count('\n') >= 5 # Verify it's properly formatted with newlines
readability_text = archive1.readability_path.read_text()
assert 'test readability content' in readability_text
assert readability_text.count('\n') >= 3 # Verify it's properly formatted with newlines
with open(archive1.readability_txt_path) as fh:
assert fh.read() == 'test readability textContent'
assert archive1.readability_json_path.read_text() == '''{