@@ -52,9 +52,9 @@ def test_mes_tax(self):
5252 selection = tax_method_of_equal_shares (profile , max_size )
5353 categorised_selection = [[], [], []]
5454 for alt in selection .selected :
55- if alt .name < 11 :
55+ if int ( alt .name ) < 11 :
5656 categorised_selection [0 ].append (alt )
57- elif alt .name < 21 :
57+ elif int ( alt .name ) < 21 :
5858 categorised_selection [1 ].append (alt )
5959 else :
6060 categorised_selection [2 ].append (alt )
@@ -69,9 +69,9 @@ def test_phragmen_tax(self):
6969 selection = tax_sequential_phragmen (profile , max_size )
7070 categorised_selection = [[], [], []]
7171 for alt in selection .selected :
72- if alt .name < 11 :
72+ if int ( alt .name ) < 11 :
7373 categorised_selection [0 ].append (alt )
74- elif alt .name < 21 :
74+ elif int ( alt .name ) < 21 :
7575 categorised_selection [1 ].append (alt )
7676 else :
7777 categorised_selection [2 ].append (alt )
@@ -86,16 +86,16 @@ def test_epjr(self):
8686 def generate_positive_selection ():
8787 res = Selection (implicit_reject = True )
8888 for a in random .sample (range (1 , 21 ), 3 ):
89- res .selected . append (profile .get_alternative_by_name (a ))
89+ res .add_selected (profile .get_alternative_by_name (str ( a ) ))
9090 for a in random .sample (range (21 , 31 ), 3 ):
91- res .selected . append (profile .get_alternative_by_name (a ))
91+ res .add_selected (profile .get_alternative_by_name (str ( a ) ))
9292
9393 alts = [a for a in profile .alternatives if not res .is_selected (a )]
9494 random .shuffle (alts )
9595 num_selected = 6
9696 for alt in alts :
9797 if random .random () < 4 / len (profile .alternatives ):
98- res .selected . append (alt )
98+ res .add_selected (alt )
9999 num_selected += 1
100100 if num_selected == max_size :
101101 break
@@ -112,9 +112,9 @@ def generate_negative_selection():
112112 res = Selection (implicit_reject = True )
113113
114114 for alt_name in random .sample (range (1 , 21 ), random .randint (0 , 2 )):
115- res .selected .append (profile .get_alternative_by_name (alt_name ))
115+ res .selected .append (profile .get_alternative_by_name (str ( alt_name ) ))
116116 for alt_name in random .sample (range (21 , 31 ), random .randint (0 , 2 )):
117- res .selected .append (profile .get_alternative_by_name (alt_name ))
117+ res .selected .append (profile .get_alternative_by_name (str ( alt_name ) ))
118118
119119 res .selected .sort ()
120120 res .rejected .sort ()
@@ -132,7 +132,7 @@ def generate_negative_selection():
132132 res = Selection (implicit_reject = True )
133133
134134 for alt_name in random .sample (range (1 , 11 ), 3 ):
135- res .selected .append (profile .get_alternative_by_name (alt_name ))
135+ res .selected .append (profile .get_alternative_by_name (str ( alt_name ) ))
136136
137137 alts = [a for a in profile .alternatives if not res .is_selected (a )]
138138 random .shuffle (alts )
0 commit comments