1- import random
21import unittest
32
4- from axelrod import short_run_time_strategies , filtered_strategies , seed
5-
3+ from axelrod import filtered_strategies , seed
4+ from axelrod . tests . property import strategy_lists
65from hypothesis import example , given , settings
76from hypothesis .strategies import integers
87
9- strategies = random .sample (short_run_time_strategies , 20 )
10-
118
129class TestFiltersAgainstComprehensions (unittest .TestCase ):
1310 """
1411 Test that the results of filtering strategies via a filterset dict
1512 match the results from using a list comprehension.
1613 """
1714
18- def test_boolean_filtering (self ):
15+ @given (strategies = strategy_lists (min_size = 20 , max_size = 20 ))
16+ def test_boolean_filtering (self , strategies ):
1917
2018 classifiers = [
2119 "stochastic" ,
@@ -35,15 +33,18 @@ def test_boolean_filtering(self):
3533 min_memory_depth = integers (min_value = 1 , max_value = 10 ),
3634 max_memory_depth = integers (min_value = 1 , max_value = 10 ),
3735 memory_depth = integers (min_value = 1 , max_value = 10 ),
36+ strategies = strategy_lists (min_size = 20 , max_size = 20 ),
3837 )
3938 @example (
4039 min_memory_depth = float ("inf" ),
4140 max_memory_depth = float ("inf" ),
4241 memory_depth = float ("inf" ),
42+ strategies = strategy_lists (min_size = 20 , max_size = 20 ),
4343 )
4444 @settings (max_examples = 5 )
4545 def test_memory_depth_filtering (
46- self , min_memory_depth , max_memory_depth , memory_depth
46+ self , min_memory_depth , max_memory_depth , memory_depth ,
47+ strategies
4748 ):
4849
4950 min_comprehension = set (
@@ -81,9 +82,11 @@ def test_memory_depth_filtering(
8182 filtered = set (filtered_strategies (filterset , strategies = strategies ))
8283 self .assertEqual (comprehension , filtered )
8384
84- @given (seed_ = integers (min_value = 0 , max_value = 4294967295 ))
85+ @given (seed_ = integers (min_value = 0 , max_value = 4294967295 ),
86+ strategies = strategy_lists (min_size = 20 , max_size = 20 ),
87+ )
8588 @settings (max_examples = 5 )
86- def test_makes_use_of_filtering (self , seed_ ):
89+ def test_makes_use_of_filtering (self , seed_ , strategies ):
8790 """
8891 Test equivalent filtering using two approaches.
8992
0 commit comments