Index: tst_TreatmentSalineData/test.py =================================================================== diff -u -rcb8d48033154f4b36a6a05b6f31bd10390e84ac7 -rcea6eac6a05f57e3317b45762a470eb18b314ab3 --- tst_TreatmentSalineData/test.py (.../test.py) (revision cb8d48033154f4b36a6a05b6f31bd10390e84ac7) +++ tst_TreatmentSalineData/test.py (.../test.py) (revision cea6eac6a05f57e3317b45762a470eb18b314ab3) @@ -16,7 +16,7 @@ import names from dialin.ui import utils from dialin import HDSimulator -HDSimulator = HDSimulator() +hd_sim = HDSimulator() def getUnit(): global saline_unit @@ -25,21 +25,21 @@ def gotoScreenNtest_Contains_TreatmentSalineBolusData(): mouseClick(waitForObject(names.o_treatmentHome_startTreatment)) - test.compare(str(waitForObjectExists(names.o_treatmentStart_SalineSection).buttonText), "START BOLUS") - test.compare(str(waitForObjectExists(names.o_treatmentStart_SalineSection).title ), "SALINE BOLUS") - test.compare( waitForObjectExists(names.o_treatmentStart_SalineSection).visible , True) + test.compare(str(waitForObjectExists(utils.dict_update(names.o_treatmentStart_SalineSection, "buttonText", "START BOLUS")).buttonText), "START BOLUS") + test.compare(str(waitForObjectExists(utils.dict_update(names.o_treatmentStart_SalineSection, "title", "SALINE BOLUS")).title), "SALINE BOLUS") + test.compare( waitForObjectExists(utils.dict_update(names.o_treatmentStart_SalineSection, "visible", True)).visible , True) def test_values(vCumulative, vDelivered): - test.compare(waitForObjectExists(names.o_treatmentStart_SalineSection).valueCumulative, vCumulative) - test.compare(waitForObjectExists(names.o_treatmentStart_SalineSection).valueDelivered , vDelivered ) + test.compare(waitForObjectExists(utils.dict_update(names.o_treatmentStart_SalineSection, "valueCumulative", vCumulative)).valueCumulative, vCumulative) + test.compare(waitForObjectExists(utils.dict_update(names.o_treatmentStart_SalineSection, "valueDelivered", vDelivered)).valueDelivered , vDelivered ) - test.compare(str(waitForObjectExists(names.o_treatmentStart_SalineCumulative).text), "{:.0f}".format(vCumulative)) - test.compare(str(waitForObjectExists(names.o_treatmentStart_SalineDelivered ).text), "{:.0f}".format(vDelivered )) + test.compare(str(waitForObjectExists(utils.dict_update(names.o_treatmentStart_SalineCumulative, "text", "{:.0f}".format(vCumulative))).text), "{:.0f}".format(vCumulative)) + test.compare(str(waitForObjectExists(utils.dict_update(names.o_treatmentStart_SalineDelivered, "text", "{:.0f}".format(vDelivered ))).text), "{:.0f}".format(vDelivered )) def test_target(vTarget): - test.compare( waitForObjectExists(names.o_treatmentStart_SalineSection).valueTarget , vTarget ) - test.compare(str(waitForObjectExists(names.o_treatmentStart_SalineTarget ).text) , "({:.0f} {})".format(vTarget, saline_unit)) + test.compare( waitForObjectExists(utils.dict_update(names.o_treatmentStart_SalineSection, "valueTarget", vTarget)).valueTarget, vTarget) + test.compare(str(waitForObjectExists(utils.dict_update(names.o_treatmentStart_SalineTarget, "text", "({:.0f} {})".format(vTarget, saline_unit))).text), "({:.0f} {})".format(vTarget, saline_unit)) def main(): @@ -56,22 +56,22 @@ cumulitive = 0 step = 1 for target in [100, 200, 300]: - HDSimulator.cmd_set_treatment_saline_bolus_data(target, 0, 0) + hd_sim.cmd_set_treatment_saline_bolus_data(target, 0, 0) test_target(target) for value in range ( 0, target, step): cumulitive += step - HDSimulator.cmd_set_treatment_saline_bolus_data(target, cumulitive, value + 1) # 0 is not a step + hd_sim.cmd_set_treatment_saline_bolus_data(target, cumulitive, value + 1) # 0 is not a step test_values ( cumulitive, value+1) # 0 is not a step - HDSimulator.cmd_set_treatment_saline_bolus_data(200, 110, 10) + hd_sim.cmd_set_treatment_saline_bolus_data(200, 110, 10) test_target (200 ) test_values ( 110, 10) - HDSimulator.cmd_set_treatment_saline_bolus_data(200, 110, 10) + hd_sim.cmd_set_treatment_saline_bolus_data(200, 110, 10) test_target (200 ) test_values ( 110, 10) - HDSimulator.cmd_set_treatment_saline_bolus_data(0, 0, 0) + hd_sim.cmd_set_treatment_saline_bolus_data(0, 0, 0) test_target ( 0 ) test_values ( 0, 0)