def test_write_statistics_with_individual(capsys, chromosome): config.INSTANCE.statistics_backend = config.StatisticsBackend.CONSOLE statistics = SearchStatistics() statistics.current_individual(chromosome) result = statistics.write_statistics() captured = capsys.readouterr() assert result assert captured.out != ""
def test_write_statistics_no_backend(): config.INSTANCE.statistics_backend = None statistics = SearchStatistics() assert not statistics.write_statistics()
def test_initialise_backend(backend, type_): config.INSTANCE.statistics_backend = backend statistics = SearchStatistics() assert isinstance(statistics._backend, type_)
def search_statistics(): return SearchStatistics()
def test_current_individual_not_test_suite_chromosome(chromosome_mock): statistics = SearchStatistics() assert statistics.current_individual(chromosome_mock) is None
def test_current_individual_no_backend(chromosome): config.INSTANCE.statistics_backend = None statistics = SearchStatistics() assert statistics.current_individual(chromosome) is None