Chromsome: Create TestImplementation for testing
@@ -18,6 +18,7 @@ import pytest
import pynguin.ga.fitnessfunction as ff
import pynguin.ga.chromosome as chrom
+from pynguin.ga.chromosome import Chromosome
@pytest.fixture
@@ -37,7 +38,13 @@ def coverage_value(fitness_function):
@pytest.fixture
def chromosome():
- return chrom.Chromosome()
+ class DummyChromosome(chrom.Chromosome):
+ def size(self) -> int:
+ raise NotImplementedError()
+
+ def cross_over(self, other: chrom.Chromosome, position1: int, position2: int) -> None:
+ raise NotImplementedError()
+ return DummyChromosome()
class _DummyFitnessFunction(ff.FitnessFunction):
@@ -48,11 +55,6 @@ class _DummyFitnessFunction(ff.FitnessFunction):
pass
-def test_size(chromosome):
- with pytest.raises(NotImplementedError):
- chromosome.size
-
-
def test_fitness_no_fitness_values(chromosome):
assert chromosome.fitness == 0.0
