from radiuma_api.task import Status
from radiuma_api.module import Module
from radiuma_api.execution_context import ExecutionContext
from radiuma_api.io_port import OutPort, ImageType
# Codes Go below:


class Dummy(Module):
    def __init__(self):
        super().__init__("Dummy")
        self._add_output_port(OutPort("o", ImageType()))

    def run(self, context):
        self._set_status(Status.RUNNING)
        context.put(self.outputs[0], None)
        self._set_status(Status.COMPLETED)

def test_task_lifecycle():
    ctx = ExecutionContext()
    t = Dummy()

    assert t.status == Status.PENDING
    t.run(ctx)
    assert t.status == Status.COMPLETED
