def test_selfing_after_outcrossing(self):
        """Test scinario: generations of selfing after generations of outcrossing."""

        # outcrossing
        self.sim.evolve(initOps=self.initOps,
                        matingScheme=simu.RandomMating(
                            subPopSize=10,
                            sexMode=self.sexMode,
                            ops=[
                                simu.MendelianGenoTransmitter(),
                                cf.MyOutcrossingTagger()
                            ]),
                        gen=10)

        for pop in self.sim.populations():
            for ind in pop.individuals():
                assert ind.info('self_gen') == 0

        assert pop.dvars().gen == 10

        # selfing
        self.sim.evolve(
            initOps=self.initOps,
            matingScheme=simu.SelfMating(
                subPopSize=10,
                sexMode=self.sexMode,
                ops=[simu.SelfingGenoTransmitter(),
                     cf.MySelfingTagger()]),
            gen=10)

        for pop in self.sim.populations():
            for ind in pop.individuals():
                assert ind.info('self_gen') == 10

        assert pop.dvars().gen == 20
    def test_pure_selfing(self):
        """Test pure inbreeding population.

        When all individuals undergo selfing, the values in `self_gen` should be identical
        to the number of generations since simulations started.
        """
        self.sim.evolve(
            initOps=self.initOps,
            matingScheme=simu.SelfMating(
                subPopSize=10,
                sexMode=self.sexMode,
                ops=[simu.SelfingGenoTransmitter(),
                     cf.MySelfingTagger()]),
            gen=10)

        for pop in self.sim.populations():
            for ind in pop.individuals():
                assert ind.info('self_gen') == 10