def test_message(self): capture_output = io.StringIO() saved_stdout = sys.stdout try: sys.stdout = capture_output EventController() EventController() actual_message = capture_output.getvalue().strip() self.assertEqual(actual_message, "EventController is a singleton and has already been instantiated. " "Use EventController.get_instance() to get instance of the class." ) finally: sys.stdout = saved_stdout
def __init__(self): super().__init__() self.turn = 0 # Singletons first self.event_controller = EventController() self.fun_stat_controller = FunStatController() self.accumulative_controller = AccumulativeController() self.city_generator_controller = CityGeneratorController() self.decree_controller = DecreeController() self.destruction_controller = DestructionController() self.disaster_controller = DisasterController() self.effort_controller = EffortController() self.game_over = False
def __init__(self): super().__init__() self.event_controller = EventController() self.contract_list = list()
def test_get(self): test_ec = EventController() test_sc = SingletonController() self.assertEqual(test_ec, EventController.get_instance()) self.assertEqual(test_sc, SingletonController.get_instance())
def test_generate(self): EventController() SingletonController()