Skip to content

Commit 3f21591

Browse files
committed
Add is_defector attribute to tests
1 parent 84e6d23 commit 3f21591

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

axelrod/tests/strategies/test_titfortat.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -622,26 +622,28 @@ def test_strategy(self):
622622
self.second_play_test(rCC=C, rCD=D, rDC=C, rDD=D)
623623

624624
actions = [(C, C), (C, C), (C, C), (D, C)]
625-
self.versus_test(axelrod.Cooperator(), expected_actions=actions)
625+
self.versus_test(axelrod.Cooperator(), expected_actions=actions,
626+
attrs={"is_defector": False})
626627

627628
actions = [(C, C), (C, C), (C, C), (C, C)]
628629
self.versus_test(axelrod.Cooperator(), expected_actions=actions,
630+
attrs={"is_defector": False},
629631
match_attributes={"length": -1})
630632

631633

632634
# Plays TfT and defects in last round
633635
actions = [(C, C), (C, D), (D, C), (C, D), (D, C), (D, D)]
634-
self.versus_test(axelrod.Alternator(), expected_actions=actions)
636+
self.versus_test(axelrod.Alternator(), expected_actions=actions
637+
attrs={"is_defector": False},)
635638

636639
actions = [(C, C), (C, D), (D, C), (C, D), (D, C), (C, D)]
637640
self.versus_test(axelrod.Alternator(), expected_actions=actions,
641+
attrs={"is_defector": False}
638642
match_attributes={"length": -1})
639643

640-
actions = [(C, C), (C, D), (D, C), (C, D), (D, C), (D, D)]
641-
self.versus_test(axelrod.Alternator(), expected_actions=actions)
642-
643644
# Becomes defector after 5 defections
644645
opponent = axelrod.MockPlayer(actions=[C, D, D, D, D, D, C, C])
645646
actions = [(C, C), (C, D), (D, D), (D, D),
646647
(D, D), (D, D), (D, C), (D, C)]
647-
self.versus_test(opponent, expected_actions=actions)
648+
self.versus_test(opponent, expected_actions=actions
649+
attrs={"is_defector": True})

0 commit comments

Comments
 (0)