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')
def test_play_pickup(self): self.loadGame() pickup2 = a2.Pickup2Card(13, a2_support.CardColour.blue) print("Played Player 0:", self._players[0].get_name()) pickup2.play(self._players[0], self._game) print("Played Player 1:", self._players[0].get_name()) self.assertEqual(self._game.get_turns().peak().get_deck().get_amount(), 2, "Playing a Pickup2Card should force the next player to pickup 2 cards") self._game.next_player() self._game.next_player() pickup4 = a2.Pickup4Card(10, a2_support.CardColour.red) pickup4.play(self._players[2], self._game) self.assertEqual(self._game.get_turns().peak().get_deck().get_amount(), 4, "Playing a Pickup4Card should force the next player to pickup 4 cards")