def test_concret_msg_sleep_time_longer_than__time_on_property(self): m = Message() m.msg = 'concret msg' value = m.msg time.sleep(6) self.assertNotEqual(value, m.msg) print(3)
def test_setter_with_delay(self): m = Message() m.msg = 'hello' initial = m.msg time.sleep(6) self.assertNotEqual(m.msg, initial, 'Must not be the same message (timer error)')
def test_resetTimer(self): m = Message() initial = m.msg self.assertEqual(m.msg, initial) time.sleep(1) self.assertEqual(m.msg, initial) m.msg = 'smth' self.assertNotEqual(m.msg, initial) initial = m.msg time.sleep(1) self.assertEqual(m.msg, initial)
def test_rndm_msg_sleep_time_longer_than_time_on_property(self): m = Message() value = m.msg time.sleep(6) self.assertNotEqual(value, m.msg) print(5)
def test_rndm_msg_sleep_time_shorter_than_time_on_property(self): m = Message() value = m.msg time.sleep(1) self.assertEqual(value, m.msg) print(4)
def test_set_concret_msg(self): m = Message() m.msg = 'concret msg' value = m.msg self.assertEqual(value, m.msg) print(1)
def obj(): """ Creates an instance of Message class for all tests""" m = Message() yield m del m
def test_setter(self): m = Message() m.msg = 'hello' initial = m.msg self.assertEqual(m.msg, initial, "Setter didn't assert new value to msg")
def test_for_msg_with_delay(self): m = Message() initial = m.msg time.sleep(6) self.assertNotEqual(m.msg, initial, 'Must not be the same message (timer error)')
def test_for_same_msg(self): m = Message() initial = m.msg self.assertEqual(m.msg, initial, 'Not the same msg')
def test_updateCache(self): m = Message() initial = m.msg self.assertEqual(m.msg, initial) time.sleep(1) self.assertEqual(m.msg, initial)
def test_sett(self): self.m = Message() self.assertEqual(type(m.msg), str)