def test_check_if_hand_contains_carre_works_with_zero_carre(self): pl = Player() res = pl.check_if_hand_contains_carres( {'8s', '9c', '10d', 'Jh', 'Qs', 'Kh', 'Ac', 'Ad'}) exp = {'8s', '9c', '10d', 'Jh', 'Qs', 'Kh', 'Ac', 'Ad'} self.assertEqual(res, exp) self.assertEqual(pl.points, 0) self.assertEqual(pl.carres, [])
def test_check_if_hand_contains_carre_finds_low_carre_and_adds_points( self): player = Player() res = player.check_if_hand_contains_carres( {'7s', '8d', 'Qs', 'Qc', 'Qd', 'Qh', 'As', 'Ah'}) exp = {'7s', '8d', 'As', 'Ah'} self.assertEqual(res, exp) self.assertEqual(player.points, 100) self.assertEqual(player.carres, [['Qs', 'Qc', 'Qd', 'Qh']])
def test_check_if_hand_contains_carre_finds_two_highest_carre_and_adds_points( self): pl = Player() res = pl.check_if_hand_contains_carres( {'9s', '9c', '9d', '9h', 'Js', 'Jh', 'Jc', 'Jd'}) exp = set() self.assertEqual(res, exp) self.assertEqual(pl.points, 350) self.assertEqual(pl.carres, [['9s', '9c', '9d', '9h'], ['Js', 'Jc', 'Jd', 'Jh']])