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_init_default_and_str(self): """Tests to see the default values for hour, minute and second (zeroes) get assigned when creating a Clock and not specifying any parameters to the Clock constructor (__init__()). This test also indirectly tests the __str__() method as well to check the values of hour, minute, and second in string form""" clock = Clock() #you can change to 00 for your tests if you would like! self.assertEqual("0:0:0", clock.__str__(), "default clock not set to 0:0:0")
def __str__(self): return Calander.__str__(self) + ", " + Clock.__str__(self)
def __str__(self): return Calendar.__str__(self) + ", " + Clock.__str__(self)
def test_init_235959(self): """Does clock set properly to 1 second before midnight?""" clock = Clock(23, 59, 59) self.assertEqual("23:59:59", clock.__str__(), "clock not set to 23:59:59")
def test_advance_minute_rollover(self): """Test advance of minute and hour due to rollover""" clock = Clock() clock.advance_minute(121) # you can change to 00 for your tests if you would like! self.assertEqual("2:1:0", clock.__str__())
def test_advance_minute_no_rollover(self): """Basic advance that will not roll over the minute or subsequently the hour""" clock = Clock() clock.advance_minute(59) # you can change to 00 for your tests if you would like! self.assertEqual("0:59:0", clock.__str__())
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")
def __str__(self): """ defines string for class Reminder """ return Calendar.__str__(self) + " " + Clock.__str__(self)