11import unittest
2-
32import itertools
4-
53import pickle
6-
74import random
8-
95import types
10-
116import numpy as np
127
138import axelrod as axl
14- from axelrod import DefaultGame , Player , LimitedHistory
159from axelrod .player import simultaneous_play
1610from axelrod .tests .property import strategy_lists
1711
@@ -47,7 +41,7 @@ def defect(*args):
4741}
4842
4943
50- class ParameterisedTestPlayer (Player ):
44+ class ParameterisedTestPlayer (axl . Player ):
5145 """A simple Player class for testing init parameters"""
5246
5347 name = "ParameterisedTestPlayer"
@@ -60,7 +54,7 @@ def __init__(self, arg_test1="testing1", arg_test2="testing2"):
6054class TestPlayerClass (unittest .TestCase ):
6155
6256 name = "Player"
63- player = Player
57+ player = axl . Player
6458 classifier = {"stochastic" : False }
6559
6660 def test_play (self ):
@@ -115,7 +109,7 @@ def test_noisy_play(self):
115109 self .assertEqual (player2 .history [0 ], D )
116110
117111 def test_update_history (self ):
118- player = Player ()
112+ player = axl . Player ()
119113 self .assertEqual (player .history , [])
120114 self .assertEqual (player .cooperations , 0 )
121115 self .assertEqual (player .defections , 0 )
@@ -129,7 +123,7 @@ def test_update_history(self):
129123 self .assertEqual (player .cooperations , 1 )
130124
131125 def test_history_assignment (self ):
132- player = Player ()
126+ player = axl . Player ()
133127 with self .assertRaises (AttributeError ):
134128 player .history = []
135129
@@ -320,9 +314,9 @@ def test_init_kwargs(self):
320314 # Test that init_kwargs exist and are empty
321315 self .assertEqual (self .player ().init_kwargs , {})
322316 # Test that passing a positional argument raises an error
323- self .assertRaises (TypeError , Player , "test" )
317+ self .assertRaises (TypeError , axl . Player , "test" )
324318 # Test that passing a keyword argument raises an error
325- self .assertRaises (TypeError , Player , arg_test1 = "test" )
319+ self .assertRaises (TypeError , axl . Player , arg_test1 = "test" )
326320
327321 # Tests for Players with init parameters
328322
@@ -353,7 +347,7 @@ def test_init_kwargs(self):
353347 self .assertRaises (TypeError , ParameterisedTestPlayer , "other" , "other" , "other" )
354348
355349
356- class TestOpponent (Player ):
350+ class TestOpponent (axl . Player ):
357351 """A player who only exists so we have something to test against"""
358352
359353 name = "TestOpponent"
@@ -376,7 +370,7 @@ def test_initialisation(self):
376370 player = self .player ()
377371 self .assertEqual (len (player .history ), 0 )
378372 self .assertEqual (
379- player .match_attributes , {"length" : - 1 , "game" : DefaultGame , "noise" : 0 }
373+ player .match_attributes , {"length" : - 1 , "game" : axl . DefaultGame , "noise" : 0 }
380374 )
381375 self .assertEqual (player .cooperations , 0 )
382376 self .assertEqual (player .defections , 0 )
@@ -682,8 +676,8 @@ def test_memory(player, opponent, memory_length, seed=0, turns=10):
682676 # Play with limited history.
683677 player .reset ()
684678 opponent .reset ()
685- player ._history = LimitedHistory (memory_length )
686- opponent ._history = LimitedHistory (memory_length )
679+ player ._history = axl . LimitedHistory (memory_length )
680+ opponent ._history = axl . LimitedHistory (memory_length )
687681 axl .seed (seed )
688682 match = axl .Match ((player , opponent ), turns = turns , reset = False )
689683 limited_plays = [p [0 ] for p in match .play ()]
0 commit comments