Skip to content

Commit 29afa8d

Browse files
committed
Update iterators to pass python3 tests
1 parent 6b2a692 commit 29afa8d

File tree

2 files changed

+2
-26
lines changed

2 files changed

+2
-26
lines changed

axelrod/result_set.py

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def _null_matrix(self):
4848

4949
def _results(self, outcome):
5050
results = {}
51-
for result_type, result_list in outcome.iteritems():
51+
for result_type, result_list in outcome.items():
5252
matrix = self._null_matrix()
5353
for index, result_matrix in enumerate(result_list):
5454
for i in range(len(self.players)):
@@ -122,26 +122,12 @@ def _normalised_cooperation(self, cooperation):
122122
for row in cooperation]
123123

124124
def csv(self):
125-
<<<<<<< HEAD
126-
if self._finalised:
127-
csv_string = StringIO()
128-
header = ",".join(self.ranked_names) + "\n"
129-
csv_string.write(header)
130-
writer = csv.writer(csv_string, lineterminator="\n")
131-
for irep in range(self.repetitions):
132-
data = [self.normalised_scores[rank][irep] for rank in self.ranking]
133-
writer.writerow(list(map(str, data)))
134-
return csv_string.getvalue()
135-
else:
136-
raise AttributeError(self.unfinalised_error_msg)
137-
=======
138125
csv_string = StringIO()
139126
header = ",".join(self.ranked_names) + "\n"
140127
csv_string.write(header)
141128
writer = csv.writer(csv_string, lineterminator="\n")
142129
for irep in range(self.repetitions):
143130
data = [self.normalised_scores[rank][irep]
144131
for rank in self.ranking]
145-
writer.writerow(map(str, data))
132+
writer.writerow(list(map(str, data)))
146133
return csv_string.getvalue()
147-
>>>>>>> refactor resultset to use payoffs and cooperation lists in init

axelrod/tests/unit/test_round_robin.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,6 @@ def test_pair_of_players(self):
102102
player2.name = 'player 2'
103103
self.assertNotEqual(player1.name, player2.name)
104104

105-
def test_deterministic_cache(self):
106-
p1, p2, p3 = axelrod.Cooperator(), axelrod.Defector(), axelrod.Random()
107-
rr = axelrod.RoundRobin(players=[p1, p2, p3], game=self.game, turns=20)
108-
self.assertEqual(rr.deterministic_cache, {})
109-
rr.play()
110-
self.assertEqual(rr.deterministic_cache[(axelrod.Defector, axelrod.Defector)], (20, 20))
111-
self.assertEqual(rr.deterministic_cache[(axelrod.Cooperator, axelrod.Cooperator)], (60, 60))
112-
self.assertEqual(rr.deterministic_cache[(axelrod.Cooperator, axelrod.Defector)], (0, 100))
113-
self.assertFalse((axelrod.Random, axelrod.Random) in rr.deterministic_cache)
114-
115105
def test_stochastic_interaction(self):
116106
p1, p2 = axelrod.Player(), axelrod.Player()
117107
rr = axelrod.RoundRobin(

0 commit comments

Comments
 (0)