class TestRouletteSelector(TestSelectorCommon):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.sut = RouletteSelector()

    def test_roulette_selection_should_work(self):
        # Given:
        self.rule_population_mock.get_all_non_terminal_rules.return_value = [
            self.expected_rule, self.rule_2, self.rule_3]
        self.randomizer_mock.uniform.return_value = 2.22

        # When:
        selected_rule = self.sut.select(
            self.service_mock, self.grammar_statistics_mock, self.rule_population_mock)

        # Then:
        assert_that(selected_rule, is_(equal_to(self.expected_rule)))
        self.rule_population_mock.get_all_non_terminal_rules.assert_called_once_with()
        self.fitness_mock.get_keyfunc_getter.assert_called_once_with(self.grammar_statistics_mock)
        self.randomizer_mock.uniform.assert_called_once_with(0, 8)
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.sut = RouletteSelector()