

def test_breed(self):
    '\n        Ensures that the crossover function is called as a result of calling\n        the breed method.\n        '
    x = Genome([1, 2, 3, 4])
    mate = Genome(['a', 'b', 'c', 'd'])
    mock_crossover = MagicMock(return_value=(Genome([1, 2, 'a', 'b']), Genome(['a', 'b', 3, 4])))
    with patch('foox.ga.crossover', x):
        x.breed(mate)
    self.assertEqual(1, mock_crossover.call_count, 'Breed does not call crossover function expected number of times.')
    mock_crossover.assert_called_with(x, mate, Genome)

dataset/ETHPy150Open ntoll/foox/test/test_ga.py TestGenome.test_breed/VarMisuse@82/159 `mock_crossover`->`x`