<s> """<STR_LIT>""" <EOL> import random <EOL> import axelrod <EOL> from . test_player import TestPlayer <EOL> C , D = axelrod . Actions . C , axelrod . Actions . D <EOL> class TestGrudger ( TestPlayer ) : <EOL> name = "<STR_LIT>" <EOL> player = axelrod . Grudger <EOL> expected_classifier = { <EOL> '<STR_LIT>' : float ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : set ( ) , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : False <EOL> } <EOL> def test_initial_strategy ( self ) : <EOL> """<STR_LIT>""" <EOL> self . first_play_test ( C ) <EOL> def test_strategy ( self ) : <EOL> """<STR_LIT>""" <EOL> self . responses_test ( [ C , D , D , D ] , [ C , C , C , C ] , [ C ] ) <EOL> self . responses_test ( [ C , C , D , D , D ] , [ C , D , C , C , C ] , [ D ] ) <EOL> class TestForgetfulGrudger ( TestPlayer ) : <EOL> name = "<STR_LIT>" <EOL> player = axelrod . ForgetfulGrudger <EOL> expected_classifier = { <EOL> '<STR_LIT>' : <NUM_LIT:10> , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : set ( ) , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : False <EOL> } <EOL> def test_strategy ( self ) : <EOL> self . responses_test ( [ ] , [ ] , [ C ] , attrs = { "<STR_LIT>" : False } ) <EOL> self . responses_test ( [ C ] , [ C ] , [ C ] , attrs = { "<STR_LIT>" : False } ) <EOL> self . responses_test ( [ C ] , [ D ] , [ D ] , attrs = { "<STR_LIT>" : True } ) <EOL> for i in range ( <NUM_LIT:10> ) : <EOL> self . responses_test ( [ C , C ] + [ D ] * i , [ C , D ] + [ C ] * i , [ D ] , <EOL> attrs = { "<STR_LIT>" : True , "<STR_LIT>" : i , <EOL> "<STR_LIT>" : <NUM_LIT:10> } ) <EOL> i = <NUM_LIT:10> <EOL> self . responses_test ( [ C , C ] + [ D ] * i + [ C ] , [ C , D ] + [ C ] * i + [ C ] , [ C ] , <EOL> attrs = { "<STR_LIT>" : False , "<STR_LIT>" : <NUM_LIT:0> , <EOL> "<STR_LIT>" : <NUM_LIT:10> } ) <EOL> def test_reset_method ( self ) : <EOL> """<STR_LIT>""" <EOL> P1 = axelrod . ForgetfulGrudger ( ) <EOL> P1 . history = [ C , D , D , D ] <EOL> P1 . grudged = True <EOL> P1 . grudge_memory = <NUM_LIT:4> <EOL> P1 . reset ( ) <EOL> self . assertEqual ( P1 . history , [ ] ) <EOL> self . assertEqual ( P1 . grudged , False ) <EOL> self . assertEqual ( P1 . grudge_memory , <NUM_LIT:0> ) <EOL> class TestOppositeGrudger ( TestPlayer ) : <EOL> name = '<STR_LIT>' <EOL> player = axelrod . OppositeGrudger <EOL> expected_classifier = { <EOL> '<STR_LIT>' : float ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : set ( ) , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : False <EOL> } <EOL> def test_initial_strategy ( self ) : <EOL> """<STR_LIT>""" <EOL> self . first_play_test ( D ) <EOL> def test_strategy ( self ) : <EOL> """<STR_LIT>""" <EOL> self . responses_test ( [ C , D , D , D ] , [ D , D , D , D ] , [ D ] ) <EOL> self . responses_test ( [ C , C , D , D , D ] , [ C , D , C , C , C ] , [ C ] ) <EOL> class TestAggravater ( TestPlayer ) : <EOL> name = "<STR_LIT>" <EOL> player = axelrod . Aggravater <EOL> expected_classifier = { <EOL> '<STR_LIT>' : float ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : set ( ) , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : False <EOL> } <EOL> def test_initial_strategy ( self ) : <EOL> """<STR_LIT>""" <EOL> self . first_play_test ( D ) <EOL> def test_strategy ( self ) : <EOL> """<STR_LIT>""" <EOL> self . responses_test ( [ C , D , D , D ] , [ C , C , C , C ] , [ C ] ) <EOL> self . responses_test ( [ C , C , D , D , D ] , [ C , D , C , C , C ] , [ D ] ) </s>
