19
19
'''
20
20
21
21
22
- @pytest .fixture
23
- def large_one_to_one ():
22
+ weighted_map_classes = [allocating .ListWeightedMap , allocating .DictWeightedMap ]
23
+
24
+ @pytest .fixture (params = weighted_map_classes )
25
+ def large_one_to_one (request ):
24
26
elements = range (20 )
25
27
sources = {str (e ): 1 for e in elements }
26
28
targets = {str (e ): 1 for e in elements }
@@ -29,13 +31,13 @@ def large_one_to_one():
29
31
wmap_list .append ({'from' : str (e ), 'to' : str (e ), 'weight' : 0 })
30
32
wmap_list .append ({'from' : str (e ), 'to' : str ((e + 1 ) % len (elements )), 'weight' : 1 })
31
33
wmap_list .append ({'from' : str (e ), 'to' : str ((e - 1 ) % len (elements )), 'weight' : 1 })
32
- wmap = allocating . ListWeightedMap (wmap_list )
34
+ wmap = request . param (wmap_list )
33
35
34
36
yield allocating .Allocator (sources , wmap , targets )
35
37
36
38
37
- @pytest .fixture
38
- def large_one_to_one_alternate ():
39
+ @pytest .fixture ( params = weighted_map_classes )
40
+ def large_one_to_one_alternate (request ):
39
41
elements = range (20 )
40
42
sources = {str (e ): 1 for e in elements }
41
43
targets = {str (e ): 1 for e in elements }
@@ -44,7 +46,7 @@ def large_one_to_one_alternate():
44
46
wmap_list .append ({'from' : str (e ), 'to' : str (e ), 'weight' : 1 })
45
47
wmap_list .append ({'from' : str (e ), 'to' : str ((e + 1 ) % len (elements )), 'weight' : 3 * (e % 2 )})
46
48
wmap_list .append ({'from' : str (e ), 'to' : str ((e - 1 ) % len (elements )), 'weight' : 2.5 })
47
- wmap = allocating . ListWeightedMap (wmap_list )
49
+ wmap = request . param (wmap_list )
48
50
49
51
yield allocating .Allocator (sources , wmap , targets )
50
52
0 commit comments