Ejemplo n.º 1
0
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 != ""
Ejemplo n.º 2
0
def test_write_statistics_no_backend():
    config.INSTANCE.statistics_backend = None
    statistics = SearchStatistics()
    assert not statistics.write_statistics()
Ejemplo n.º 3
0
def test_initialise_backend(backend, type_):
    config.INSTANCE.statistics_backend = backend
    statistics = SearchStatistics()
    assert isinstance(statistics._backend, type_)
Ejemplo n.º 4
0
def search_statistics():
    return SearchStatistics()
Ejemplo n.º 5
0
def test_current_individual_not_test_suite_chromosome(chromosome_mock):
    statistics = SearchStatistics()
    assert statistics.current_individual(chromosome_mock) is None
Ejemplo n.º 6
0
def test_current_individual_no_backend(chromosome):
    config.INSTANCE.statistics_backend = None
    statistics = SearchStatistics()
    assert statistics.current_individual(chromosome) is None