Exemple #1
0
    def test_playing_card(self):
        card = PlayingCard(rank='ACE', suit='SPADES')
        self.assertEqual(card.rank, 'ACE')
        self.assertEqual(card.suit, 'SPADES')

        r = card.__repr__()
        self.assertEqual(r, '<PlayingCard: ACE of SPADES>')

        card_dict = card.to_dict()
        self.assertEqual(card_dict['rank'], 'ACE')
        self.assertEqual(card_dict['suit'], 'SPADES')
Exemple #2
0
    def test_playing_card(self):
        card = PlayingCard(rank='ACE', suit='SPADES')
        self.assertEqual(card.rank, 'ACE')
        self.assertEqual(card.suit, 'SPADES')

        r = card.__repr__()
        self.assertEqual(r, '<PlayingCard: ACE of SPADES>')

        card_dict = card.to_dict()
        self.assertEqual(card_dict['rank'], 'ACE')
        self.assertEqual(card_dict['suit'], 'SPADES')
Exemple #3
0
 def test_generate_playing_cards(self):
     cards = PlayingCard.generate_cards()
     for card in cards:
         self.assertTrue(isinstance(card, PlayingCard))
Exemple #4
0
 def test_playing_card_from_json(self):
     card_json = json.dumps({'rank': 'ACE', 'suit': 'SPADES'})
     card = PlayingCard.from_json(card_json=card_json)
     self.assertEqual(card.rank, 'ACE')
     self.assertEqual(card.suit, 'SPADES')
Exemple #5
0
 def test_playing_card_to_json(self):
     card = PlayingCard(rank='ACE', suit='SPADES')
     card_json = card.to_json()
     card_dict = json.loads(card_json)
     self.assertEqual(card_dict['rank'], 'ACE')
     self.assertEqual(card_dict['suit'], 'SPADES')
Exemple #6
0
 def test_generate_playing_cards(self):
     cards = PlayingCard.generate_cards()
     for card in cards:
         self.assertTrue(isinstance(card, PlayingCard))
Exemple #7
0
 def test_playing_card_from_json(self):
     card_json = json.dumps({'rank': 'ACE', 'suit': 'SPADES'})
     card = PlayingCard.from_json(card_json=card_json)
     self.assertEqual(card.rank, 'ACE')
     self.assertEqual(card.suit, 'SPADES')
Exemple #8
0
 def test_playing_card_to_json(self):
     card = PlayingCard(rank='ACE', suit='SPADES')
     card_json = card.to_json()
     card_dict = json.loads(card_json)
     self.assertEqual(card_dict['rank'], 'ACE')
     self.assertEqual(card_dict['suit'], 'SPADES')