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,6 +33,7 @@ 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" ),
@@ -43,7 +42,8 @@ def test_boolean_filtering(self):
4342 )
4443 @settings (max_examples = 5 )
4544 def test_memory_depth_filtering (
46- self , min_memory_depth , max_memory_depth , memory_depth
45+ self , min_memory_depth , max_memory_depth , memory_depth ,
46+ strategies
4747 ):
4848
4949 min_comprehension = set (
@@ -81,9 +81,11 @@ def test_memory_depth_filtering(
8181 filtered = set (filtered_strategies (filterset , strategies = strategies ))
8282 self .assertEqual (comprehension , filtered )
8383
84- @given (seed_ = integers (min_value = 0 , max_value = 4294967295 ))
84+ @given (seed_ = integers (min_value = 0 , max_value = 4294967295 ),
85+ strategies = strategy_lists (min_size = 20 , max_size = 20 ),
86+ )
8587 @settings (max_examples = 5 )
86- def test_makes_use_of_filtering (self , seed_ ):
88+ def test_makes_use_of_filtering (self , seed_ , strategies ):
8789 """
8890 Test equivalent filtering using two approaches.
8991
0 commit comments