@@ -539,4 +539,35 @@ def test_cut_generation(self):
539539 self .assertEqual (p ._individuals , [4 , 4 , 4 ])
540540
541541 individual = mlc_repo .get_individual (4 )
542- self .assertEqual (individual .get_value (), "4+4" )
542+ self .assertEqual (individual .get_value (), "4+4" )
543+
544+ def test_remove_population_to_from_bad_values (self ):
545+ mlc_repo = self .__get_new_repo ()
546+
547+ # add individuals
548+ mlc_repo .add_individual (Individual ("1+1" ))
549+ mlc_repo .add_individual (Individual ("2+2" ))
550+ mlc_repo .add_individual (Individual ("3+3" ))
551+ mlc_repo .add_individual (Individual ("4+4" ))
552+ mlc_repo .add_individual (Individual ("5+5" ))
553+
554+ # add population
555+ p = Population (3 , 0 , Config .get_instance (), mlc_repo )
556+ p ._individuals = [1 , 1 , 1 ]
557+ mlc_repo .add_population (p )
558+
559+ # add population
560+ p = Population (3 , 0 , Config .get_instance (), mlc_repo )
561+ p ._individuals = [2 , 2 , 2 ]
562+ mlc_repo .add_population (p )
563+
564+ # add population
565+ p = Population (3 , 0 , Config .get_instance (), mlc_repo )
566+ p ._individuals = [3 , 3 , 3 ]
567+ mlc_repo .add_population (p )
568+
569+ self .assertEqual (mlc_repo .count_population (), 3 )
570+
571+ # Remove all generations (1 to 3)
572+ mlc_repo .remove_population_to (10 )
573+ self .assertEqual (mlc_repo .count_population (), 0 )
0 commit comments