77
88from axelrod import Actions
99from axelrod ._strategy_utils import detect_cycle
10- from axelrod ._strategy_utils import Memoized
1110
1211C , D = Actions .C , Actions .D
1312
@@ -26,40 +25,3 @@ def test_no_cycle(self):
2625
2726 history = [D , D , C , C , C ]
2827 self .assertIsNone (detect_cycle (history ))
29-
30-
31- class TestMemoized (unittest .TestCase ):
32- """Test the Memoized class"""
33-
34- def test_init (self ):
35- func = lambda x : x + x
36- memoized = Memoized (func )
37- self .assertEqual (memoized .func , func )
38- self .assertEqual (memoized .cache , {})
39-
40- def test_call_with_unhashable_type (self ):
41- func = lambda x : x + x
42- memoized = Memoized (func )
43- self .assertEqual (memoized ([2 ]), [2 , 2 ])
44- self .assertEqual (memoized .cache , {})
45-
46- def test_call (self ):
47- func = lambda x : x + x
48- memoized = Memoized (func )
49- self .assertEqual (memoized .cache , {})
50- self .assertEqual (memoized (2 ), 4 )
51- self .assertEqual (memoized .cache , {(2 ,): 4 })
52- self .assertEqual (memoized (2 ), 4 )
53- self .assertEqual (memoized .cache , {(2 ,): 4 })
54-
55- def test_repr (self ):
56- func = lambda x : x + x
57- memoized = Memoized (func )
58- self .assertEqual (memoized .__repr__ (), None )
59-
60- def func_with_docstring (x ):
61- """A docstring"""
62- return x + x
63-
64- memoized = Memoized (func_with_docstring )
65- self .assertEqual (memoized .__repr__ (), "A docstring" )
0 commit comments