I have a bunch of functions these functions append the string value 'FAIL or PASS in a list and depending on fail or pass a GUI window(PyQT5) should open up. But even though all the values in all the Lists are 'PASS' the window for 'FAIL' window opens up. I think my if else condition is wrong if someone could correct it for me or show me how to do it that would be much appreciated.
Please show me a more accurate or the correct way to do this.
def checkbox_ledNA(self):
self.LedResult = []
self.LED_pass_na = 'PASS'
self.LED_fail_na = 'FAIL'
pass_fail_na = lambda state_na: self.LED_pass_na if state_na == 2 else self.LED_fail_na
self.checkPWR_rot_na = pass_fail_na(self.ui.PWR_rot_NA.checkState())
self.LedResult.append(self.checkPWR_rot_na)
self.checkPWR_grun_na = pass_fail_na(self.ui.PWR_grun_NA.checkState())
self.LedResult.append(self.checkPWR_grun_na)
self.checkP1_na = pass_fail_na(self.ui.Port1_NA.checkState())
def parameter_vergleich(self):
self.confResult = []
####################################################
if self.ord_nmr == self.artikel_na:
print("Artikel number matched")
self.ord = 'PASS'
else:
print("Artikel did not match")
self.ord = 'FAIL'
self.confResult.append(self.ord)
####################################################
if self.firmware_version == self.firmwareV_na:
print("Firmware version matched")
self.fv = 'PASS'
else:
print("Firmware version did not match")
self.fv = 'FAIL'
self.confResult.append(self.fv)
def get_output_rx(self):
while True:
self.size = self.ser.inWaiting()
if self.size > 190:
self.rx = 'PASS'
print(self.size, ' RX-Leitung ', self.rx)
if self.rx == 'PASS':
break
else:
self.rx = 'FAIL'
if self.rx == 'FAIL':
break
print(' RX-Leitung ', self.rx)
break
self.rxtxResult.append(self.rx)
return self.rx
def checkResult_na(self):
if 'FAIL' in self.pingTestResult or self.rxtxResult or self.LedResult or self.confResult:
self.failWindow()
else:
self.passWindow()