def test_check_match(self): game = SetGame() game.triplet = [0, 1, 2] game.hand = [['empty', 'blue', 'squiggly', 1], ['striped', 'green', 'squiggly', 2], ['empty', 'red', 'squiggly', 3]] self.assertEqual(False, game.check_match()) game.hand = [['empty', 'blue', 'squiggly', 1], ['striped', 'green', 'squiggly', 2], ['full', 'red', 'squiggly', 3]] self.assertEqual(True, game.check_match())
def test_all_different(self): game = SetGame() game.hand = [['empty', 'blue', 'squiggly', 1], ['striped', 'green', 'squiggly', 2], ['empty', 'red', 'squiggly', 3]] game.triplet = [0, 1, 2] self.assertEqual(False, game.all_different(0)) self.assertEqual(True, game.all_different(1)) self.assertEqual(False, game.all_different(2)) self.assertEqual(True, game.all_different(3))
def test_check_hand(self): game = SetGame() game.hand = [['full', 'green', 'squiggly', 3], ['full', 'blue', 'squiggly', 2], ['full', 'green', 'diamond', 1], # card 2 ['full', 'red', 'squiggly', 2], ['empty', 'green', 'squiggly', 1], # card 4 ['striped', 'red', 'oval', 3], ['full', 'blue', 'oval', 1], # card 6 ['empty', 'blue', 'squiggly', 3], ['empty', 'blue', 'diamond', 1], # card 8 ['striped', 'red', 'diamond', 1], # card 9 ['full', 'red', 'squiggly', 3], ['striped', 'red', 'oval', 1]] expected = [[2, 8, 9], [4, 6, 9]] matches = game.check_hand() self.assertEqual(expected, matches)