Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions spectrafit/test/test_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from lmfit import Parameters
from pytest_mock.plugin import MockerFixture
from spectrafit.report import PrintingResults
from spectrafit.report import PrintingStatus
from spectrafit.report import RegressionMetrics
from spectrafit.report import _extracted_gof_from_results
from spectrafit.report import get_init_value
Expand Down Expand Up @@ -141,3 +142,45 @@ def test_get_init_value(
assert get_init_value(par_expr) == f"As expressed value: {par_expr.expr}"
assert get_init_value(**par_model) == 2.0
assert get_init_value(par_fixed) == f"As fixed value: {par_fixed.min}"


class TestPrintingStatus:
"""Test of the printing status."""

ps = PrintingStatus()

def assert_capfd(self, capfd: Any) -> None:
"""Assert the capfd."""
out, err = capfd.readouterr()
assert isinstance(out, str)
assert err == ""

def test_welcome(self, capfd: Any) -> None:
"""Test of the welcome message."""
self.ps.welcome
self.assert_capfd(capfd=capfd)

def test_version(self, capfd: Any) -> None:
"""Test of the version message."""
self.ps.version
self.assert_capfd(capfd=capfd)

def test_start(self, capfd: Any) -> None:
"""Test of the start message."""
self.ps.start
self.assert_capfd(capfd=capfd)

def test_end(self, capfd: Any) -> None:
"""Test of the end message."""
self.ps.end
self.assert_capfd(capfd=capfd)

def test_yes_no(self, capfd: Any) -> None:
"""Test of the yes no message."""
self.ps.yes_no
self.assert_capfd(capfd=capfd)

def test_credits(self, capfd: Any) -> None:
"""Test of the credits message."""
self.ps.credits
self.assert_capfd(capfd=capfd)