Index: dialin/ui/__init__.py =================================================================== diff -u -ra08848ed6275cf2afa3bfb7f3c87709b69c224bc -rf194e9e62ce2513823f5320774bc793448ee3809 --- dialin/ui/__init__.py (.../__init__.py) (revision a08848ed6275cf2afa3bfb7f3c87709b69c224bc) +++ dialin/ui/__init__.py (.../__init__.py) (revision f194e9e62ce2513823f5320774bc793448ee3809) @@ -1 +1,2 @@ +from .hd_proxy import HDSimulator +from .hd_proxy_alarms import HDProxyAlarms Index: tests/test_dg_valves.py =================================================================== diff -u -rb62b040b80e3b42e9749ee8689f5d65c5dcc71e0 -rf194e9e62ce2513823f5320774bc793448ee3809 --- tests/test_dg_valves.py (.../test_dg_valves.py) (revision b62b040b80e3b42e9749ee8689f5d65c5dcc71e0) +++ tests/test_dg_valves.py (.../test_dg_valves.py) (revision f194e9e62ce2513823f5320774bc793448ee3809) @@ -1,40 +1,60 @@ ########################################################################### # -# Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. +# Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. # -# THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN -# WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. +# THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN +# WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. # -# @file dg_valves_test.py +# @file unit_tests.py # -# @date 20-May-2020 -# @author P. Montazemi +# @author (last) Peter Lucia +# @date (last) 13-Jul-2020 +# @author (original) Peter Lucia +# @date (original) 13-Jul-2020 # -# @brief This development test script exercises the DG valves states in \n -# single and batch modes -# ############################################################################ - +import unittest import sys -sys.path.append("..") +sys.path.append("../..") +from datetime import datetime from dialin.dg.dialysate_generator import DG -from time import sleep -if __name__ == "__main__": - # Create an instance of the DG Class called dg - dg = DG() - sleep(2) - # Log in to DG as tester - if dg.cmd_log_in_to_dg() == 0: - print("DG login failed.") - exit(1) +class DGValves(unittest.TestCase): - dg.valves.cmd_valve_override(True, 3, 0) - for i in range(len(dg.valves.get_valve_states())): - dg.valves.cmd_valve_override(False, i, 1) - while True: - sleep(1) - # dg.valves.cmd_valve_override(True, 3, 1) - dg.valves.cmd_valve_override(True, 3, 0) - print(dg.valves.get_valve_states()) + # @unittest.skip("Skipping test_imports") + def test_dg_valves_conversion(self): + dg = DG() + observation = {'datetime': datetime(2020, 7, 13, 10, 43, 27, 433357), + 'valve_state_VBF': {'id': 5, 'state': True}, + 'valve_state_VDR': {'id': 7, 'state': True}, + 'valve_state_VPD': {'id': 12, 'state': True}, + 'valve_state_VPI': {'id': 8, 'state': True}, + 'valve_state_VPO': {'id': 4, 'state': True}, + 'valve_state_VR1': {'id': 10, 'state': True}, + 'valve_state_VR2': {'id': 11, 'state': True}, + 'valve_state_VRC': {'id': 6, 'state': True}, + 'valve_state_VRD': {'id': 2, 'state': True}, + 'valve_state_VRF': {'id': 0, 'state': True}, + 'valve_state_VRI': {'id': 1, 'state': True}, + 'valve_state_VRO': {'id': 3, 'state': True}, + 'valve_state_VSP': {'id': 9, 'state': True}, + 'valve_states_all': 8191} + + assert(dg.valves.sort_by_id(observation) == [('valve_state_VRF', 0, True), + ('valve_state_VRI', 1, True), + ('valve_state_VRD', 2, True), + ('valve_state_VRO', 3, True), + ('valve_state_VPO', 4, True), + ('valve_state_VBF', 5, True), + ('valve_state_VRC', 6, True), + ('valve_state_VDR', 7, True), + ('valve_state_VPI', 8, True), + ('valve_state_VSP', 9, True), + ('valve_state_VR1', 10, True), + ('valve_state_VR2', 11, True), + ('valve_state_VPD', 12, True)]) + + +if __name__ == '__main__': + sys.exit(unittest.main(verbosity=2).result.wasSuccessful()) Index: tests/test_ui_proxy.py =================================================================== diff -u --- tests/test_ui_proxy.py (revision 0) +++ tests/test_ui_proxy.py (revision f194e9e62ce2513823f5320774bc793448ee3809) @@ -0,0 +1,35 @@ +########################################################################### +# +# Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. +# +# THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN +# WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. +# +# @file test_imports.py +# +# @date 29-Apr-2020 +# @author P. Lucia +# +# @brief Tests imports of all available modules +# +############################################################################ +import unittest +import sys +sys.path.append("../..") +from dialin.hd.hemodialysis_device import HD + + +class DGValves(unittest.TestCase): + + # @unittest.skip("Skipping test_imports") + def test_hd_get_reject_reasons(self): + hd = HD() + + i = 0 + for key, value in hd.ui.get_reject_reasons().items(): + self.assertEqual(i, value) + i += 1 + + +if __name__ == '__main__': + sys.exit(unittest.main(verbosity=2).result.wasSuccessful()) Fisheye: Tag f194e9e62ce2513823f5320774bc793448ee3809 refers to a dead (removed) revision in file `tests/unit_tests/test_dg_valves.py'. Fisheye: No comparison available. Pass `N' to diff? Index: tests/unit_tests/test_imports.py =================================================================== diff -u -rb543d90a50cbef509d10f4c1412d87bf6eee2e4e -rf194e9e62ce2513823f5320774bc793448ee3809 --- tests/unit_tests/test_imports.py (.../test_imports.py) (revision b543d90a50cbef509d10f4c1412d87bf6eee2e4e) +++ tests/unit_tests/test_imports.py (.../test_imports.py) (revision f194e9e62ce2513823f5320774bc793448ee3809) @@ -102,6 +102,7 @@ from dialin.dg import TemperatureSensors from dialin.dg import DGValves + from dialin.ui import HDSimulator, HDProxyAlarms if __name__ == '__main__': - unittest.main(verbosity=2) + sys.exit(unittest.main(verbosity=2).result.wasSuccessful()) Fisheye: Tag f194e9e62ce2513823f5320774bc793448ee3809 refers to a dead (removed) revision in file `tests/unit_tests/test_ui_proxy.py'. Fisheye: No comparison available. Pass `N' to diff?