def test_subscribe_to_time_changes_complex(self): time_options_manager = TimeOptionsManager() result = {"result": "Time Options after Change:", "increment": 0} def time_change_callback(time, minutes, seconds): result["increment"] += 1 result["result"] += "\n Change " + result["increment"].__str__( ) + "| " + time time_options_manager.subscribe_to_timechange(time_change_callback) time_options_manager.increment_seconds() time_options_manager.increment_seconds() time_options_manager.increment_seconds() time_options_manager.decrement_seconds() time_options_manager.decrement_seconds() time_options_manager.decrement_seconds() time_options_manager.decrement_seconds() time_options_manager.decrement_minutes() time_options_manager.decrement_minutes() time_options_manager.increment_minutes() time_options_manager.increment_minutes() time_options_manager.increment_minutes() time_options_manager.increment_minutes() time_options_manager.increment_minutes() Approvals.verify(result["result"], TextDiffReporter())
def test_subscribe_to_time_changes(self): time_options_manager = TimeOptionsManager() result = {"result": "time"} def time_change_callback(time, minutes, seconds): result["result"] += " " + time time_options_manager.subscribe_to_timechange(time_change_callback) time_options_manager.increment_seconds() self.assertEqual(result["result"], "time 10:00 10:15")