Skip to content

Commit

Permalink
Add serialization test
Browse files Browse the repository at this point in the history
  • Loading branch information
marcharper committed Oct 18, 2019
1 parent a6d935b commit 6ac46a8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions axelrod/tests/strategies/test_evolvable_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,17 @@ def test_serialization(self):
self.assertEqual(player, deserialized_player)
self.assertEqual(deserialized_player, deserialized_player.clone())

def test_serialization_csv(self):
"""Serializing and deserializing should return the original player."""
seed(0)
player = self.player()
serialized = player.serialize_parameters()
s = "0, 1, {}, 3".format(serialized)
s2 = s.split(',')[2]
deserialized_player = player.__class__.deserialize_parameters(s2)
self.assertEqual(player, deserialized_player)
self.assertEqual(deserialized_player, deserialized_player.clone())

def behavior_test(self, player1, player2):
"""Test that the evolvable player plays the same as its (nonevolvable) parent class."""
for opponent_class in [axl.Random, axl.TitForTat, axl.Alternator]:
Expand Down

0 comments on commit 6ac46a8

Please sign in to comment.