def test_get_fault_list_with_indices(self, hthp: HtHeatpump): size = hthp.get_fault_list_size() for cnt in range(size + 1): indices = random.sample(range(size), cnt) fault_list = hthp.get_fault_list(*indices) assert isinstance(fault_list, list), "'fault_list' must be of type list" for entry in fault_list: assert isinstance(entry, dict), "'entry' must be of type dict" index = entry["index"] assert isinstance(index, int), "'index' must be of type int" assert 0 <= index < hthp.get_fault_list_size() error = entry["error"] assert isinstance(error, int), "'error' must be of type int" assert error >= 0 dt = entry["datetime"] assert isinstance( dt, datetime.datetime), "'dt' must be of type datetime" msg = entry["message"] assert isinstance(msg, str), "'msg' must be of type str"
def test_get_fault_list_with_index(self, hthp: HtHeatpump): size = hthp.get_fault_list_size() assert isinstance(size, int), "'size' must be of type int" assert size >= 0 for i in range(size): fault_list = hthp.get_fault_list(i) assert isinstance(fault_list, list), "'fault_list' must be of type list" assert len(fault_list) == 1 entry = fault_list[0] assert isinstance(entry, dict), "'entry' must be of type dict" index = entry["index"] assert isinstance(index, int), "'index' must be of type int" assert 0 <= index < hthp.get_fault_list_size() error = entry["error"] assert isinstance(error, int), "'error' must be of type int" assert error >= 0 dt = entry["datetime"] assert isinstance( dt, datetime.datetime), "'dt' must be of type datetime" msg = entry["message"] assert isinstance(msg, str), "'msg' must be of type str"
def test_get_last_fault(self, hthp: HtHeatpump): fault = hthp.get_last_fault() # (29, 20, datetime.datetime(...), "EQ_Spreizung") assert isinstance(fault, tuple), "'fault' must be of type tuple" assert len(fault) == 4 index, error, dt, msg = fault assert isinstance(index, int), "'index' must be of type int" assert 0 <= index < hthp.get_fault_list_size() assert isinstance(error, int), "'error' must be of type int" assert error >= 0 assert isinstance(dt, datetime.datetime), "'dt' must be of type datetime" assert isinstance(msg, str), "'msg' must be of type str"
def test_get_fault_list(self, hthp: HtHeatpump): fault_list = hthp.get_fault_list() # [ { "index": 29, # fault list index # "error": 20, # error code # "datetime": datetime.datetime(...), # date and time of the entry # "message": "EQ_Spreizung", # error message # }, # # ... # ] assert isinstance(fault_list, list), "'fault_list' must be of type list" for entry in fault_list: assert isinstance(entry, dict), "'entry' must be of type dict" index = entry["index"] assert isinstance(index, int), "'index' must be of type int" assert 0 <= index < hthp.get_fault_list_size() error = entry["error"] assert isinstance(error, int), "'error' must be of type int" assert error >= 0 dt = entry["datetime"] assert isinstance( dt, datetime.datetime), "'dt' must be of type datetime" msg = entry["message"] assert isinstance(msg, str), "'msg' must be of type str"
def test_get_fault_list_size(self, hthp: HtHeatpump): size = hthp.get_fault_list_size() assert isinstance(size, int), "'size' must be of type int" assert size >= 0