Skip to content

Commit d63c668

Browse files
marcharperdrvinceknight
authored andcommitted
Fix failing unittests in test_dbs.py
1 parent b1c08c5 commit d63c668

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

axelrod/tests/strategies/test_dbs.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import axelrod
44
import unittest
55
from .test_player import TestPlayer
6-
from axelrod import dbs
6+
from axelrod.strategies import dbs
77

88
C, D = axelrod.Actions.C, axelrod.Actions.D
99

@@ -15,18 +15,18 @@ class TestNode(unittest.TestCase):
1515
node = dbs.Node()
1616

1717
def test_get_siblings(self):
18-
with self.assertRaises(NotImplementedError) as context:
18+
with self.assertRaises(NotImplementedError):
1919
self.node.get_siblings()
2020

2121
def test_is_stochastic(self):
22-
with self.assertRaises(NotImplementedError) as context:
22+
with self.assertRaises(NotImplementedError):
2323
self.node.is_stochastic()
2424

2525

2626
class TestTreeSearch(unittest.TestCase):
2727
"""
2828
A set of tests for the tree-search functions.
29-
We test the answers of both minimax_tree_search and MoveGen
29+
We test the answers of both minimax_tree_search and move_gen
3030
functions, against a set of classic policies (the answer being the
3131
best move to play for the next turn, considering an income
3232
position (C, C), (C, D), (D, C) or (D, D))
@@ -36,7 +36,7 @@ def setUp(self):
3636
"""
3737
Initialization for tests.
3838
"""
39-
# For each test, we check the answer againt each possible
39+
# For each test, we check the answer against each possible
4040
# inputs, that are in self.input_pos
4141
self.input_pos = [(C, C), (C, D), (D, C), (D, D)]
4242
# We define the policies against which we are going to test
@@ -62,14 +62,14 @@ def test_minimaxTreeSearch_cooperator(self):
6262
self.cooperator_policy, max_depth=5)
6363
self.assertEqual(values.index(max(values)),out)
6464

65-
def test_MoveGen_cooperator(self):
65+
def test_move_gen_cooperator(self):
6666
"""
67-
Tests the MoveGen function when playing against a
67+
Tests the move_gen function when playing against a
6868
Cooperator player.
6969
"""
7070
expected_output = [D, D, D, D]
7171
for inp, out in zip(self.input_pos, expected_output):
72-
out_move = dbs.MoveGen(inp, self.cooperator_policy,
72+
out_move = dbs.move_gen(inp, self.cooperator_policy,
7373
depth_search_tree=5)
7474
self.assertEqual(out_move, out)
7575

@@ -86,14 +86,14 @@ def test_minimaxTreeSearch_defector(self):
8686
self.defector_policy, max_depth=5)
8787
self.assertEqual(values.index(max(values)),out)
8888

89-
def test_MoveGen_defector(self):
89+
def test_move_gen_defector(self):
9090
"""
91-
Tests the MoveGen function when playing against a
91+
Tests the move_gen function when playing against a
9292
Defector player.
9393
"""
9494
expected_output = [D, D, D, D]
9595
for inp, out in zip(self.input_pos, expected_output):
96-
out_move = dbs.MoveGen(inp, self.defector_policy,
96+
out_move = dbs.move_gen(inp, self.defector_policy,
9797
depth_search_tree=5)
9898
self.assertEqual(out_move, out)
9999

@@ -123,14 +123,14 @@ def test_last_node_titForTat(self):
123123
self.titForTat_policy, max_depth=1)
124124
self.assertEqual(values.index(max(values)),out)
125125

126-
def test_MoveGen_titForTat(self):
126+
def test_move_gen_titForTat(self):
127127
"""
128-
Tests the MoveGen function when playing against a
128+
Tests the move_gen function when playing against a
129129
TitForTat player.
130130
"""
131131
expected_output = [C, C, C, C]
132132
for inp, out in zip(self.input_pos, expected_output):
133-
out_move = dbs.MoveGen(inp, self.titForTat_policy,
133+
out_move = dbs.move_gen(inp, self.titForTat_policy,
134134
depth_search_tree=5)
135135
self.assertEqual(out_move, out)
136136

@@ -147,14 +147,14 @@ def test_minimaxTreeSearch_alternator(self):
147147
self.alternator_policy, max_depth=5)
148148
self.assertEqual(values.index(max(values)),out)
149149

150-
def test_MoveGen_alternator(self):
150+
def test_move_gen_alternator(self):
151151
"""
152-
Tests the MoveGen function when playing against an
152+
Tests the move_gen function when playing against an
153153
Alternator player.
154154
"""
155155
expected_output = [D, D, D, D]
156156
for inp, out in zip(self.input_pos, expected_output):
157-
out_move = dbs.MoveGen(inp, self.random_policy, depth_search_tree=5)
157+
out_move = dbs.move_gen(inp, self.random_policy, depth_search_tree=5)
158158
self.assertEqual(out_move, out)
159159

160160
def test_minimaxTreeSearch_random(self):
@@ -170,14 +170,14 @@ def test_minimaxTreeSearch_random(self):
170170
self.random_policy, max_depth=5)
171171
self.assertEqual(values.index(max(values)),out)
172172

173-
def test_MoveGen_random(self):
173+
def test_move_gen_random(self):
174174
"""
175-
Tests the MoveGen function when playing against a
175+
Tests the move_gen function when playing against a
176176
Random player.
177177
"""
178178
expected_output = [D, D, D, D]
179179
for inp, out in zip(self.input_pos, expected_output):
180-
out_move = dbs.MoveGen(inp, self.random_policy, depth_search_tree=5)
180+
out_move = dbs.move_gen(inp, self.random_policy, depth_search_tree=5)
181181
self.assertEqual(out_move, out)
182182

183183
def test_minimaxTreeSearch_grudger(self):
@@ -194,14 +194,14 @@ def test_minimaxTreeSearch_grudger(self):
194194
self.grudger_policy, max_depth=5)
195195
self.assertEqual(values.index(max(values)),out)
196196

197-
def test_MoveGen_grudger(self):
197+
def test_move_gen_grudger(self):
198198
"""
199-
Tests the MoveGen function when playing against a
199+
Tests the move_gen function when playing against a
200200
Grudger player.
201201
"""
202202
expected_output = [C, D, D, D]
203203
for inp, out in zip(self.input_pos, expected_output):
204-
out_move = dbs.MoveGen(inp,
204+
out_move = dbs.move_gen(inp,
205205
self.grudger_policy, depth_search_tree=5)
206206
self.assertEqual(out_move, out)
207207

0 commit comments

Comments
 (0)