def test_reset(self): h = History() h.append(C, D) self.assertEqual(len(h), 1) self.assertEqual(h.cooperations, 1) h.reset() self.assertEqual(len(h), 0) self.assertEqual(h.cooperations, 0)
def test_str_list_repr(self): h = History() h.append(C, D) h.append(D, C) h.append(C, D) self.assertEqual(str(h), "CDC") self.assertEqual(list(h), [C, D, C]) self.assertEqual(repr(h), "[C, D, C]") h2 = h.flip_plays() self.assertEqual(str(h2), "DCD")