@@ -245,21 +245,29 @@ def setUpClass(cls):
245
245
cls .players = [s () for s in test_strategies ]
246
246
247
247
@given (repetitions = integers (min_value = 1 , max_value = test_repetitions ),
248
- prob_end = floats (min_value = .2 , max_value = .7 ))
249
- @example (repetitions = test_repetitions , prob_end = .5 )
250
- def test_build_match_chunks (self , repetitions , prob_end ):
248
+ prob_end = floats (min_value = .2 , max_value = .7 ),
249
+ noise = floats (min_value = 0 , max_value = 1 ))
250
+ @example (repetitions = test_repetitions , prob_end = .5 , noise = 0 )
251
+ def test_build_match_chunks (self , repetitions , prob_end , noise ):
251
252
edges = [(0 , 1 ), (1 , 2 ), (3 , 4 )]
252
- noise = 0
253
253
pesp = axelrod .ProbEndSpatialMatches (
254
254
self .players , prob_end , test_game , repetitions , noise , edges )
255
255
chunks = list (pesp .build_match_chunks ())
256
- match_definitions = [tuple (list (index_pair ) + [repetitions ])
257
- for (index_pair , match_params , repetitions ) in chunks ]
258
- expected_match_definitions = [(edge [0 ], edge [1 ], repetitions )
259
- for edge in edges ]
260
256
261
- self .assertEqual (sorted (match_definitions ),
262
- sorted (expected_match_definitions ))
257
+ match_definitions = set ()
258
+
259
+ cache = None
260
+ attributes = {'game' : test_game , 'length' : float ('inf' ), 'noise' : noise }
261
+ expected_params_without_turns = (test_game , cache , noise , attributes )
262
+
263
+ for index_pair , match_params , repetitions in chunks :
264
+ match_definitions .add (tuple (list (index_pair ) + [repetitions ]))
265
+ self .assertEqual (match_params [1 :], expected_params_without_turns )
266
+
267
+ expected_match_definitions = set ((edge [0 ], edge [1 ], repetitions )
268
+ for edge in edges )
269
+
270
+ self .assertEqual (match_definitions , expected_match_definitions )
263
271
264
272
def test_len (self ):
265
273
edges = [(0 , 1 ), (1 , 2 ), (3 , 4 )]
@@ -297,8 +305,7 @@ def test_build_matches_different_length(self, prob_end):
297
305
chunks = pesp .build_match_chunks ()
298
306
match_lengths = [match_params [0 ]
299
307
for (index_pair , match_params , repetitions ) in chunks ]
300
- self .assertNotEqual (min (match_lengths ), max (match_lengths ),
301
- msg = str (match_lengths ))
308
+ self .assertNotEqual (min (match_lengths ), max (match_lengths ))
302
309
303
310
@given (noise = floats (min_value = 0 , max_value = 1 ),
304
311
prob_end = floats (min_value = 0 , max_value = 1 ))
0 commit comments