SIENTIAPDE-1430: Remove verbose options and direct print statements from model, preprocessor, and report utilities.

This commit is contained in:
Bruno Domingues
2025-12-18 21:09:12 -03:00
parent 13941fc3f7
commit 38fb9a9c53
4 changed files with 13 additions and 89 deletions

View File

@@ -24,15 +24,13 @@ def test_load_html_from_file_success(tmp_path):
assert content == '<p>Hello</p>'
def test_load_html_from_file_missing_file(capsys):
def test_load_html_from_file_missing_file():
result = reports.load_html_from_file('non-existent.html')
captured = capsys.readouterr()
assert result is None
assert 'File not found: non-existent.html' in captured.out
def test_load_html_from_file_os_error(monkeypatch, capsys):
def test_load_html_from_file_os_error(monkeypatch):
def fake_open(*_args, **_kwargs):
raise OSError('boom')
@@ -40,9 +38,7 @@ def test_load_html_from_file_os_error(monkeypatch, capsys):
result = reports.load_html_from_file('path.html')
captured = capsys.readouterr()
assert result is None
assert 'Error reading file: boom' in captured.out
def test_inject_content_replaces_section():
@@ -57,15 +53,15 @@ def test_inject_content_replaces_section():
assert section.find('span').text == 'new'
def test_inject_content_missing_section(capsys):
def test_inject_content_missing_section():
main_html = "<html><body><div id='other'>keep</div></body></html>"
result = reports.inject_content(main_html, 'missing', '<p>ignored</p>')
captured = capsys.readouterr()
assert "Section with id 'missing' not found" in captured.out
# Content should be unchanged when section is missing
soup = BeautifulSoup(result, 'html.parser')
assert soup.find(id='other') is not None
assert soup.find(id='other').text == 'keep'
def test_reports_init_sets_defaults(stub_color_options):