def test_mask(self): card = Card(Card.SUIT_DIAMOND, Card.RANK_TWO) self.assertEqual(card.mask, d2.mask) self.assertEqual(Card.from_mask(d2.mask), card)
def test_eq(self): self.assertEqual(Card.from_mask(Card.DIAMOND_THREE.mask), Card.from_mask(Card.DIAMOND_THREE.mask)) self.assertEqual(Card.from_mask(Card.DIAMOND_THREE.mask), Card(Card.SUIT_DIAMOND, Card.RANK_THREE))
def test_invalid(self): with self.assertRaises(InvalidInstance): Card.from_mask(1) with self.assertRaises(InvalidInstance): Card(10, 10)