Exemplo n.º 1
0
 def test_card_json_serialization_unknown_suit(self):
     class WeirdSuit(object):
         def __init__(self, symbol):
             self.symbol = symbol
     weird_suit = WeirdSuit(u'\u2283')
     original_card = Card('9', weird_suit)
     with pytest.raises(UnknownSuitError) as ex:
         passed_card = Card.from_json(original_card.to_json())
     assert 'No suit found for symbol' in str(ex.value)
Exemplo n.º 2
0
 def test_card_json_serialization_bad_json(self):
     with pytest.raises(json.decoder.JSONDecodeError):
         Card.from_json('{')
Exemplo n.º 3
0
 def test_card_json_serialization(self):
     original_card = Card('9', Suit.CLUB)
     passed_card = Card.from_json(original_card.to_json())
     assert original_card == passed_card