def test_availability(): print("Testing availability:", end=" ") try: with contextlib.redirect_stdout(None): m = Module("test13") m.addSender("name", value=10) assert m.getLSAvailability(sender=True) == ([True], []) m.stopModule() print("SUCCESSED") except: print("FAILED") assert False
def test_addSender(): print("Add Sender to Module:", end=" ") try: with contextlib.redirect_stdout(None): m = Module("test1") m.addSender("name", value=10) assert m.getValue("name") == 10 assert m["name"][0] == 10 m.stopModule() print("SUCCESSED") except: print("FAILED") assert False
def test_restart(): print("Restarting Sender from Module:", end=" ") try: with contextlib.redirect_stdout(None): m = Module("test4") m.addSender("name", value=10) m.restartModule("name") m.stopModule() assert True print("SUCCESSED") except: print("FAILED") assert False
def test_addListener2(): print("Add Listener to Module with Sender:", end=" ") try: with contextlib.redirect_stdout(None): m = Module("test3") m.addSender("name", value=10) m2 = Module("test3b") m2.addListener("name") assert m2.getValue("name") == 10 assert m2["name"][0] == 10 m.stopModule() m2.stopModule() print("SUCCESSED") except: print("FAILED") assert False
def test_(): print("Stopping Modules:", end=" ") try: with contextlib.redirect_stdout(None): m = Module("test12a") m2 = Module("test12b") m.addSender("name", value=10) m2.addListener("name") m.stopModule("name") m.stopModule() m2.stopModule() assert True print("SUCCESSED") except: print("FAILED") assert False
def test_delSender(): print("Removing Sender:", end=" ") try: with contextlib.redirect_stdout(None): m = Module("test10") m.addSender("name", value=10) _s, _ = m.getLSName() assert len(_s) == 1 m.delSender("name") _s, _ = m.getLSName() assert len(_s) == 0 m.stopModule() print("SUCCESSED") except: print("FAILED") assert False
def test_setValue3(): print("Listener edit value:", end=" ") try: with contextlib.redirect_stdout(None): m = Module("test9a") m.addSender("name", value=10) m2 = Module("test9b") m2.addListener("name") m2.setValue("name", 20) assert m.getValue("name") == 20 assert m2["name"][0] == 20 m.stopModule() m2.stopModule() print("SUCCESSED") except: print("FAILED") assert False
def test_delListener(): print("Removing Listener:", end=" ") try: with contextlib.redirect_stdout(None): m = Module("test11a") m2 = Module("test11b") m.addSender("name", value=10) m2.addListener("name") _, _l = m2.getLSName() assert len(_l) == 1 m2.delListener("name") _, _l = m2.getLSName() assert len(_l) == 0 m.stopModule() m2.stopModule() print("SUCCESSED") except: print("FAILED") assert False