def testSatisfyConstraintsImpossibleConstraint(self): h = HandInformation(hand_size=1, possible_cards=set(range(6))) h.addKnownCard(0) h.addConstraint([1, 2]) hands = h.satisfyConstraints() self.assertEqual(len(hands), 0)
def testAddKnownCard(self): h = HandInformation(hand_size=3) h.addKnownCard(PEOPLE[0]) self.assertTrue(PEOPLE[0] in h.known_cards) self.assertFalse(PEOPLE[0] in h.possible_cards) self.assertEqual(h.num_unknown_cards, 2) pass
def testSatisfyConstraintsSatisfiedConstraint(self): # This test ensures that a satisifed constraint is not processed. h = HandInformation(hand_size=2, possible_cards=set(range(6))) h.addKnownCard(0) h.addConstraint([0, 1, 2]) hands = h.satisfyConstraints() self.assertEqual(len(hands), 1) self.assertEqual(hands[0].hand_size, h.hand_size) self.assertEqual(hands[0].known_cards, h.known_cards) self.assertEqual(hands[0].possible_cards, h.possible_cards)