"""WizardKit: Test object and functions"""
# vim: sts=2 sw=2 ts=2

from dataclasses import dataclass, field
from typing import Any, Callable

@dataclass(slots=True)
class Test:
  """Object for tracking test specific data."""
  dev: Any
  label: str
  name: str
  disabled: bool = field(init=False, default=False)
  failed: bool = field(init=False, default=False)
  passed: bool = field(init=False, default=False)
  report: list[str] = field(init=False, default_factory=list)
  status: str = field(init=False, default='Pending')

  def set_status(self, status) -> None:
    """Update status string."""
    if self.disabled:
      # Don't change status if disabled
      return

    self.status = status


@dataclass(slots=True)
class TestGroup:
  """Object for tracking groups of tests."""
  name: str
  function: Callable
  test_objects: list[Test] = field(default_factory=list)
