From 7ac06e16c0045933d939bd2dfcb612aeb67135e9 Mon Sep 17 00:00:00 2001 From: Harshal Sawant Date: Mon, 21 Sep 2026 19:06:39 +0530 Subject: [PATCH] test: add contract tests for all ProgressPorts (fixes #87) --- tests/unit/test_progress_ports.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/unit/test_progress_ports.py diff --git a/tests/unit/test_progress_ports.py b/tests/unit/test_progress_ports.py new file mode 100644 index 0000000..788c2c1 --- /dev/null +++ b/tests/unit/test_progress_ports.py @@ -0,0 +1,24 @@ +from modeldock.adapters.progress.rich_progress import RichProgress +from modeldock.adapters.progress.silent import SilentProgress +from modeldock.adapters.progress.tqdm_progress import TqdmProgress + +def test_rich_progress_contract(): + port = RichProgress() + # Verify the port follows the contract methods + port.start(total=100, desc="Testing Rich") + port.update(advance=50) + port.finish() + +def test_tqdm_progress_contract(): + port = TqdmProgress() + port.start(total=100, desc="Testing TQDM") + port.update(advance=50) + port.finish() + +def test_silent_progress_contract(): + port = SilentProgress() + # Silent progress might not need all arguments, but it must accept them + # to fulfill the shared contract. + port.start(total=100, desc="Testing Silent") + port.update(advance=50) + port.finish() \ No newline at end of file