def test_change_settings(self): default_setting = Setting.default_setting() config = { Setting.max_drawn_card_count: 10, Setting.stockpile_dead_card_count: 4.5, Setting.is_allowed_pick_up_discard: 0 } settings = Settings() settings.change_settings(config=config) self.assertEqual(settings.max_drawn_card_count, 10) self.assertEqual(settings.stockpile_dead_card_count, default_setting[Setting.stockpile_dead_card_count]) self.assertEqual(settings.is_allowed_pick_up_discard, default_setting[Setting.is_allowed_pick_up_discard])
def __init__(self, allow_step_back=False): '''Initialize the class GinRummyGame ''' self.allow_step_back = allow_step_back self.settings = Settings() self.actions = None # must reset in init_game self.round = None # must reset in init_game
def test_corrected_settings(self): default_setting = Setting.default_setting() config = { Setting.max_drawn_card_count: 10, Setting.stockpile_dead_card_count: 4.5, Setting.is_allowed_pick_up_discard: 0 } corrected_config = Settings.get_config_with_invalid_settings_set_to_default_value( config=config) self.assertEqual(corrected_config[Setting.max_drawn_card_count], 10) self.assertEqual(corrected_config[Setting.stockpile_dead_card_count], default_setting[Setting.stockpile_dead_card_count]) self.assertEqual(corrected_config[Setting.is_allowed_pick_up_discard], default_setting[Setting.is_allowed_pick_up_discard])