def test_play_reverse(self): self.loadGame() self.assertEqual(self._players[0], self._game.get_turns().current(), "Game should start with first player") reverse_card = a2.ReverseCard(-1, a2_support.CardColour.blue) reverse_card.play(self._players[0], self._game) self.assertEqual(self._players[-1].get_name(), self._game.get_turns().peak().get_name(), "Playing ReverseCard should reverse order") self._game.get_turns().skip(count=4) self.assertEqual(self._players[-5].get_name(), self._game.get_turns().current().get_name(), "Playing ReverseCard should reverse order") reverse_card.play(self._players[-5], self._game) self._game.get_turns().skip(count=2) self.assertEqual(self._players[-2].get_name(), self._game.get_turns().current().get_name(), "Playing ReverseCard should reverse order")
def test_card_str(self): card = a2.Card(90, a2_support.CardColour.red) skip = a2.SkipCard(12, a2_support.CardColour.yellow) reverse = a2.ReverseCard(3, a2_support.CardColour.green) pickup2 = a2.Pickup2Card(45, a2_support.CardColour.blue) pickup4 = a2.Pickup4Card(56, a2_support.CardColour.black) self.assertEqual(str(card), 'Card(90, CardColour.red)', 'Card.__str__ does not return correctly') self.assertEqual(repr(card), 'Card(90, CardColour.red)', 'Card.__repr__ does not return correctly') self.assertEqual(str(skip), 'SkipCard(12, CardColour.yellow)', 'SkipCard.__str__ does not return correctly') self.assertEqual(repr(skip), 'SkipCard(12, CardColour.yellow)', 'SkipCard.__repr__ does not return correctly') self.assertEqual(str(reverse), 'ReverseCard(3, CardColour.green)', 'ReverseCard.__str__ does not return correctly') self.assertEqual(repr(reverse), 'ReverseCard(3, CardColour.green)', 'ReverseCard.__repr__ does not return correctly') self.assertEqual(str(pickup2), 'Pickup2Card(45, CardColour.blue)', 'Pickup2Card.__str__ does not return correctly') self.assertEqual(repr(pickup2), 'Pickup2Card(45, CardColour.blue)', 'Pickup2Card.__repr__ does not return correctly') self.assertEqual(str(pickup4), 'Pickup4Card(56, CardColour.black)', 'Pickup4Card.__str__ does not return correctly') self.assertEqual(repr(pickup4), 'Pickup4Card(56, CardColour.black)', 'Pickup4Card.__repr__ does not return correctly')