def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.sut = TerminalCoverageOperator() self.environment_mock.get_sentence_symbol.return_value = Symbol(hash('a')) self.rule_population_mock.get_random_non_terminal_symbol.return_value = Symbol(hash('A'))
class TestTerminalCoverageOperator(CoverageOperatorTestCommon): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.sut = TerminalCoverageOperator() self.environment_mock.get_sentence_symbol.return_value = Symbol(hash('a')) self.rule_population_mock.get_random_non_terminal_symbol.return_value = Symbol(hash('A')) def test_operators_execute_with_some_chance(self): self.rule_population_mock.get_random_non_terminal_symbol.return_value = Symbol(hash('C')) self.operator_executes_with_some_chance_scenario() def test_given_unknown_terminal_symbol_should_cover_it(self): # When: result = self.sut.cover(self.cyk_service_mock, self.environment_mock, self.rule_population_mock, self.coordinates) # Then: assert_that(result, is_(equal_to(Production( Detector(self.coordinates), TerminalRule(Symbol(hash('A')), Symbol(hash('a')))))))