# Path: app/state.py
# class State:
# class ProgramNotFound(Exception):
#     def __init__(self, is_hd=True):
#     def set_model(self, is_hd):
#     def start_program(self, name, params={}):
#     def stop_program(self):
#     def _get_program(self, name):
#     def _set_brightness(self, params):
#     def _set_rotation(self, params):
#     def _start_process(self, program, params):
#         def run_program(self):


import unittest
import time
import app.programs.hd
import app.programs.original
from app.state import state, ProgramNotFound



class TestState(unittest.TestCase):

    def tearDown(self):
        if state._process is not None:
            state._process.terminate()

    def start_all(self, list):
        for name, _ in list.items():
            with self.subTest(program=name):
                r = state.start_program(name)
                self.assertTrue(state._process.is_alive())

    def test_start_all_hd(self):
        state.set_model(is_hd=True)
        self.start_all(app.programs.hd.list)

    def test_start_all_original(self):
        state.set_model(is_hd=False)
        self.start_all(app.programs.original.list)

    def test_start_not_found(self):

# Path: app/state.py
# class State:
# class ProgramNotFound(Exception):
#     def __init__(self, is_hd=True):
#     def set_model(self, is_hd):
#     def start_program(self, name, params={}):
#     def stop_program(self):
#     def _get_program(self, name):
#     def _set_brightness(self, params):
#     def _set_rotation(self, params):
#     def _start_process(self, program, params):
#         def run_program(self):


# Path: app/tests/test_state.py
import unittest
import time
import app.programs.hd
import app.programs.original
from app.state import state, ProgramNotFound




class TestState(unittest.TestCase):

    def tearDown(self):
        if state._process is not None:
            state._process.terminate()

    def start_all(self, list):
        for name, _ in list.items():
            with self.subTest(program=name):
                r = state.start_program(name)
                self.assertTrue(state._process.is_alive())

    def test_start_all_hd(self):
        state.set_model(is_hd=True)
        self.start_all(app.programs.hd.list)

    def test_start_all_original(self):
        state.set_model(is_hd=False)
        self.start_all(app.programs.original.list)

    def test_start_not_found(self):

        with self.assertRaises(ProgramNotFound):