Example #1
0
class GuesserTest(unittest.TestCase):

    def setUp(self):
        self.the_guessing_game = Guesser()
        self.the_guessing_game.computer_thought = 15

    def test_control_logic(self):
        #we set the users guess
        self.the_guessing_game.users_guess = 5
        self.assertEqual(self.the_guessing_game.control_logic(), 1, "The computer is higher.")

        self.the_guessing_game.users_guess = 20
        self.assertEqual(self.the_guessing_game.control_logic(), -1, "The computer is lower.")

        self.the_guessing_game.users_guess = 15
        self.assertEqual(self.the_guessing_game.control_logic(), 0, "The user guessed right.")
Example #2
0
 def setUp(self):
     self.the_guessing_game = Guesser()
     self.the_guessing_game.computer_thought = 15