def test_repr_naipes2(self): #Revisa si la representasion esta funcionando para la guaya self.assertTrue( Naipe.from_int(0).repr_naipe() == "\N{PLAYING CARD ACE OF SPADES}") self.assertTrue( Naipe.from_int(51).repr_naipe() == "\N{PLAYING CARD KING OF DIAMONDS}") self.assertTrue( Naipe.from_int(30).repr_naipe() == "\N{PLAYING CARD FIVE OF CLUBS}") self.assertTrue( Naipe.from_int(20).repr_naipe() == "\N{PLAYING CARD EIGHT OF HEARTS}")
def test_int_naipe_conversion(self): n = Naipe((2, 2)) self.assertTrue(Naipe.from_int(n.get_as_int()) == n) self.assertTrue(Naipe.from_int(43).get_as_int() == 43) self.assertTrue(n.get_as_tuple() == (2, 2)) self.assertTrue( Naipe.from_int(n.get_as_int()).get_as_tuple() == (2, 2)) n = Naipe((1, 2)) self.assertTrue(n.get_as_tuple() == (1, 2)) with self.assertRaises(AssertionError): n = Naipe((0, 2)) # numero comienza de 1 no de cero with self.assertRaises(AssertionError): Naipe((14, 1)) with self.assertRaises(AssertionError): Naipe((2, -1)) with self.assertRaises(AssertionError): Naipe((2, 4))