From f14ddf505800f7e7f5c6f1d5baf75ef5f3bb1693 Mon Sep 17 00:00:00 2001 From: Jvst Me Date: Wed, 27 Mar 2024 17:13:34 +0100 Subject: [PATCH] Add tests for reason and status conversions --- src/tests/_internal/core/models/test_runs.py | 24 ++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/tests/_internal/core/models/test_runs.py diff --git a/src/tests/_internal/core/models/test_runs.py b/src/tests/_internal/core/models/test_runs.py new file mode 100644 index 000000000..576eba61a --- /dev/null +++ b/src/tests/_internal/core/models/test_runs.py @@ -0,0 +1,24 @@ +from dstack._internal.core.models.runs import ( + JobStatus, + JobTerminationReason, + RunStatus, + RunTerminationReason, +) + + +def test_run_to_job_termination_reason_works_with_all_enum_variants(): + for run_termination_reason in RunTerminationReason: + job_termination_reason = run_termination_reason.to_job_termination_reason() + assert isinstance(job_termination_reason, JobTerminationReason) + + +def test_run_termination_reason_to_status_works_with_all_enum_variants(): + for run_termination_reason in RunTerminationReason: + run_status = run_termination_reason.to_status() + assert isinstance(run_status, RunStatus) + + +def test_job_termination_reason_to_status_works_with_all_enum_varians(): + for job_termination_reason in JobTerminationReason: + job_status = job_termination_reason.to_status() + assert isinstance(job_status, JobStatus)