def test_advance_hour_rollover_48(self): """Test that hour advances by 48 (2 days) which should leave it back where it started""" clock = Clock() clock.advance_hour(48) # you can change to 00 for your tests if you would like! self.assertEqual("0:0:0", clock.__str__(), "advance hour from 0 by 48 back to 0 did not work")
def test_advance_hour_negative(self): """Advance hour with negative value which should raise a ValueError""" clock = Clock() try: clock.advance_hour(-1) self.assertEqual( True, False, "exception not thrown for advance hour value of -1") except ValueError as value_error: self.assertEqual(True, True)
def test_advance_hour_no_rollover(self): """Simple advance hour test that does not roll over to new set of hours""" clock = Clock() clock.advance_hour(23) self.assertEqual("23:0:0", clock.__str__(), "advance hour from 0 to 23 did not work")