Handling empty strings better

pull/1175/head
Brian Daniels 2015-06-12 12:34:38 -05:00
parent f2ea9c51c7
commit 0ca1389d95
2 changed files with 5 additions and 6 deletions

View File

@ -31,11 +31,10 @@ class SerialNCRXTest():
out_str = selftest.mbed.serial_readline()
if out_str == None:
if not out_str:
selftest.notify("HOST: No output detected")
return selftest.RESULT_IO_SERIAL
out_str_stripped = out_str.strip(strip_chars)
if out_str_stripped != "RX OK - Expected":
@ -51,7 +50,7 @@ class SerialNCRXTest():
out_str = selftest.mbed.serial_readline()
# If no characters received, pass the test
if out_str == "" or out_str == None:
if not out_str:
selftest.notify("HOST: No further output detected")
return selftest.RESULT_SUCCESS
else:

View File

@ -26,13 +26,13 @@ class SerialNCTXTest():
def test(self, selftest):
selftest.mbed.flush();
selftest.mbed.serial_write("S");
strip_chars = string.whitespace + "\0"
out_str = selftest.mbed.serial_readline()
selftest.notify("HOST: " + out_str)
if out_str == None:
if not out_str:
selftest.notify("HOST: No output detected")
return selftest.RESULT_IO_SERIAL
@ -45,7 +45,7 @@ class SerialNCTXTest():
out_str = selftest.mbed.serial_readline()
# If no characters received, pass the test
if out_str == "" or out_str == None:
if not out_str:
selftest.notify("HOST: No further output detected")
return selftest.RESULT_SUCCESS
else: