class TestAngryDicePrintResults(unittest.TestCase): def setUp(self): """ Initializes the die for the following testing functions """ self.game = AngryDice() # print(self.shortDescription()) def tearDown(self): """ delete the instance of game after running tests """ del self.game @patch('sys.stdout', new_callable=StringIO) def test_print_results(self, mock_stdout): """ initialize and test the output """ self.game.stage = 1 self.game.die_a = "2" self.game.die_b = "3" self.game.outcome = "This is a Test" output = "\nYou are in Stage {}\n" \ "-------------------------------\n" \ "You rolled:\n" \ "a = [ {} ]\n" \ "b = [ {} ]\n" \ "{}".format(1, "2", "3", "This is a Test\n") self.game.print_results() self.assertMultiLineEqual(mock_stdout.getvalue(), output, "output matches the print_results format")
class GetRollTest(unittest.TestCase): """Test get_roll for exit conditions, and a proper list of die to roll""" def setUp(self): self.new_game = AngryDice(False) print(self.shortDescription()) @patch('builtins.input', return_value="exit") def test_exit_condition(self, mock_input): """when given 'exit' input we expect game_over to be true""" self.assertEqual(['exit'], self.new_game.get_roll()) self.assertTrue(self.new_game.game_over) @patch('builtins.input', return_value="a") def test_a_condition(self, mock_input): """when given 'a' input we expect to be given a list ['a']""" self.assertEqual(['a'], self.new_game.get_roll()) @patch('builtins.input', return_value="b") def test_b_condition(self, mock_input): """when given 'b' input we expect to be given a list ['b']""" self.assertEqual(['b'], self.new_game.get_roll()) @patch('builtins.input', return_value="ba") def test_ab_condition(self, mock_input): """when given 'ba' input we expect to be given a list ['b', 'a']""" self.assertEqual(['a', 'b'], self.new_game.get_roll()) @patch('builtins.input', side_effect=["sdf", "wii", "stuff", "", "a"]) def test_invalid_condition(self, mock_input): """when given a bad input we expect to be prompted for an input until we provide valid""" self.assertEqual(['a'], self.new_game.get_roll())
class AngryCheckTest(unittest.TestCase): """Tests that AngryDie's angry check function works""" def setUp(self): self.new_game = AngryDice(False) print(self.shortDescription()) def test_if_both_values_are_angry_we_get_true(self): """This checks if check_angry returns True if we are angry.""" self.new_game.current_dice_a_value = "ANGRY" self.new_game.current_dice_b_value = "ANGRY" self.assertTrue(self.new_game.check_angry(), "We're expecting to be returned true because both dice" "values are set to ANGRY") def test_if_current_stage_is_set_to_1_if_angry(self): """This checks if the current stage is set to 1 if are `angry`""" self.new_game.current_dice_a_value = "ANGRY" self.new_game.current_dice_b_value = "ANGRY" self.new_game.check_angry() self.assertEqual(1, self.new_game.current_stage) @patch('sys.stdout', new_callable=StringIO) def test_if_print_works_for_angry(self, mock_stdout): """Checks print statement when player hits status of angry.""" error_message = "The print statement doesn't match the requried" angry_text = "WOW, you're ANGRY!\n" + "Time to go back to Stage 1!\n" self.new_game.current_dice_a_value = "ANGRY" self.new_game.current_dice_b_value = "ANGRY" self.new_game.check_angry() self.assertEqual(mock_stdout.getvalue(), angry_text, error_message) # Greedy angry checks def test_that_angry_check_doesnt_cause_false_pos_for_one_angry_dice_a(self): """currently B dice values is angry, do we have a false positives""" self.new_game.current_dice_a_value = 1 self.new_game.current_dice_b_value = "ANGRY" self.assertFalse(self.new_game.check_angry()) def test_that_angry_check_doesnt_cause_false_pos_for_one_angry_dice_b(self): """currently A dice values is angry, do we have a false positives""" self.new_game.current_dice_a_value = "ANGRY" self.new_game.current_dice_b_value = 4 self.assertFalse(self.new_game.check_angry()) def test_that_angry_check_doesnt_cause_false_pos_for_either_angry_dice_b(self): """currently no dice values are angry, do we have a false positives""" self.new_game.current_dice_a_value = 1 self.new_game.current_dice_b_value = 4 self.assertFalse(self.new_game.check_angry())
class TestAngryDiceCheatingStatus(unittest.TestCase): def setUp(self): """ Initializes the die for the following testing functions """ self.game = AngryDice() # print(self.shortDescription()) def tearDown(self): """ delete the instance of game after running tests """ del self.game def test_cheating_status_hold_a6_roll_b4(self): """ [6, 4], user holds a6 and rolls b4, is cheating """ self.game.stage = 3 self.game.userInput = "b" self.assertTrue(self.game.cheating_status("6", "4"), "[6, 4], hold a, roll b, cheating") self.assertIn("You're cheating!", self.game.outcome, "cheating") def test_cheating_status_roll_a4_hold_b6(self): """ [4, 6], user holds a4 and rolls b6, is cheating """ self.game.stage = 3 self.game.userInput = "a" self.assertTrue(self.game.cheating_status("4", "6"), "[4, 6], roll a, hold b, cheating") self.assertIn("You're cheating!", self.game.outcome, "cheating") def test_cheating_status_hold_a6_hold_b6(self): """ [6, 6], user holds a6 and holds b6, is cheating """ self.game.stage = 3 self.game.userInput = "" self.assertTrue(self.game.cheating_status("6", "6"), "[6, 6], hold a, hold b, cheating") self.assertIn("You're cheating!", self.game.outcome, "cheating") def test_cheating_status_roll_a6_hold_b6(self): """ [6, 6], user rolls a6 and holds b6, is cheating """ self.game.stage = 3 self.game.userInput = "b" self.assertTrue(self.game.cheating_status("6", "6"), "[6, 6], hold a, roll b, cheating") self.assertIn("You're cheating!", self.game.outcome, "cheating") def test_cheating_status_roll_a6_roll_b6(self): """ [6, 6], user rolls a6 and rolls b6, not cheating """ self.game.stage = 3 self.game.userInput = "ab" self.assertFalse(self.game.cheating_status("6", "6"), "[6, 6], roll a, roll b, not cheating") self.assertNotIn("You're cheating!", self.game.outcome, "notcheating") def test_cheating_status_roll_a1_roll_b1(self): """ [6, 6], user rolls a6 and rolls b6, not cheating """ self.game.stage = 3 self.game.userInput = "ab" self.assertFalse(self.game.cheating_status("1", "1"), "[1, 1], roll a, roll b, not cheating") self.assertNotIn("You're cheating!", self.game.outcome, "not cheating")
class TestAngryDiceStage3(unittest.TestCase): def setUp(self): """ Initializes the die for the following testing functions """ self.game = AngryDice() # print(self.shortDescription()) def tearDown(self): """ delete the instance of game after running tests """ del self.game def test_stage3_a5_b6(self): """ [5, 6] win, game over """ self.game.finalCheck = False self.game.stage_3("5", "6") self.assertEqual(True, self.game.finalCheck, "[5, 6], win, game over") self.assertMultiLineEqual("\n-------------------------------" \ "\n-------------------------------" \ "\nYou've won! Calm down!\n", self.game.outcome, "win, game over") def test_stage3_a5_b1(self): """ [5, 1] finalCheck stays False """ self.game.finalCheck = False self.game.stage_3("5", "1") self.assertNotEqual(True, self.game.finalCheck, "[5, 1], " "stays at stage 3") self.assertEqual("", self.game.outcome, "stays at stage 3") def test_stage3_a6_b5(self): """ [5, 6] win, game over """ self.game.finalCheck = False self.game.stage_3("6", "5") self.assertEqual(True, self.game.finalCheck, "[6, 5], win, game over") self.assertMultiLineEqual("\n-------------------------------" \ "\n-------------------------------" \ "\nYou've won! Calm down!\n", self.game.outcome, "win, game over") def test_stage3_a1_b1(self): """ [1, 1] finalCheck stays False """ self.game.finalCheck = False self.game.stage_3("1", "1") self.assertNotEqual(True, self.game.finalCheck, "[1, 1], " "stays at stage 3") self.assertEqual("", self.game.outcome, "stays at stage 3")
class TestAngryDiceStage2(unittest.TestCase): def setUp(self): """ Initializes the die for the following testing functions """ self.game = AngryDice() # print(self.shortDescription()) def tearDown(self): """ delete the instance of game after running tests """ del self.game def test_stage2_aAngry_b4(self): """ [1, 2] stage becomes 2 """ self.game.stage = 2 self.game.stage_2("ANGRY", "4") self.assertEqual(3, self.game.stage, "[Angry, 4], changes to stage 3") self.assertIn("Stage 2 completed", self.game.outcome, "now stage 3") def test_stage2_aAngry_b1(self): """ [1, 2] stage stays 1 """ self.game.stage = 2 self.game.stage_2("ANGRY", "1") self.assertNotEqual(3, self.game.stage, "[Angry, 1], stays at stage 2") self.assertNotIn("Stage 2 completed", self.game.outcome, "stay stage 2") def test_stage2_a4_bAngry(self): """ [2, 1] stage becomes 2 """ self.game.stage = 2 self.game.stage_2("4", "ANGRY") self.assertEqual(3, self.game.stage, "[4, Angry], changes to stage 3") self.assertIn("Stage 2 completed", self.game.outcome, "now stage 3") def test_stage2_a1_b1(self): """ [3, 3] stage stays 1 """ self.game.stage = 2 self.game.stage_2("1", "1") self.assertNotEqual(3, self.game.stage, "[1, 1], stays at stage 2") self.assertNotIn("Stage 2 completed", self.game.outcome, "stay stage 2")
class TestAngryDiceStage1(unittest.TestCase): def setUp(self): """ Initializes the die for the following testing functions """ self.game = AngryDice() # print(self.shortDescription()) def tearDown(self): """ delete the instance of game after running tests """ del self.game def test_stage1_a1_b2(self): """ [1, 2] stage becomes 2 """ self.game.stage = 1 self.game.stage_1("1", "2") self.assertEqual(2, self.game.stage, "[1, 2], changes to stage 2") self.assertIn("Stage 1 completed", self.game.outcome, "now stage 2") def test_stage1_a1_b3(self): """ [1, 2] stage stays 1 """ self.game.stage = 1 self.game.stage_1("1", "3") self.assertNotEqual(2, self.game.stage, "[1, 3], stays at stage 1") self.assertNotIn("Stage 1 completed", self.game.outcome, "stay stage 1") def test_stage1_a2_b1(self): """ [2, 1] stage becomes 2 """ self.game.stage = 1 self.game.stage_1("2", "1") self.assertEqual(2, self.game.stage, "[2, 1], changes to stage 2") self.assertIn("Stage 1 completed", self.game.outcome, "now stage 2") def test_stage1_a3_b3(self): """ [3, 3] stage stays 1 """ self.game.stage = 1 self.game.stage_1("3", "3") self.assertNotEqual(2, self.game.stage, "[3, 3], stays at stage 1") self.assertNotIn("Stage 1 completed", self.game.outcome, "stay stage 2")
class TestAngryDiceCheckStage(unittest.TestCase): def setUp(self): """ Initializes the die for the following testing functions """ self.game = AngryDice() # print(self.shortDescription()) def tearDown(self): """ delete the instance of game after running tests """ del self.game def test_check_stage_stage2_aAngry_bAngry(self): """ [Angry, Angry], does stage 2 change aAngry, bAngry """ self.game.die_a.currentValue = "ANGRY" self.game.die_b.currentValue = "ANGRY" self.game.stage = 2 self.game.check_stage() self.assertEqual(1, self.game.stage, "[Angry, Angry], stage 2 changes to 1") self.assertIn("back to Stage 1", self.game.outcome, "reset to stage 1") def test_check_stage_stage3_aAngry_bAngry(self): """ [Angry, Angry], does stage 3 change aAngry, bAngry """ self.game.die_a.currentValue = "ANGRY" self.game.die_b.currentValue = "ANGRY" self.game.stage = 3 self.game.check_stage() self.assertEqual(1, self.game.stage, "[Angry, Angry], stage 3 changes to 1") self.assertIn("back to Stage 1", self.game.outcome, "reset to stage 1") def test_check_stage_stage2_a1_bAngry(self): """ [Angry, 1], does stage 2 remain a1, bAngry """ self.game.die_a.currentValue = "1" self.game.die_b.currentValue = "ANGRY" self.game.stage = 2 self.game.check_stage() self.assertNotEqual(1, self.game.stage, "[1, Angry], stage 2 still 2") self.assertNotIn("back to Stage 1", self.game.outcome, "remain on Stage 2")
def setUp(self): """ Initializes the die for the following testing functions """ self.game = AngryDice()
class TestAngryDiceCheckUserInput(unittest.TestCase): def setUp(self): """ Initializes the die for the following testing functions """ self.game = AngryDice() # print(self.shortDescription()) def tearDown(self): """ delete the instance of game after running tests """ del self.game def test_check_user_input_change_currentValue_a9_roll_a(self): """ [9, x], does currentValue a9 change after roll a """ self.game.die_a.currentValue = 9 self.game.userInput = "a" self.game.check_user_input() self.assertNotEqual(9, self.game.die_a.currentValue, "[9, x], die_a currentValue not 9") def test_check_user_input_change_currentValue_b9_roll_b(self): """ [x, 9], does currentValue b9 change after roll b """ self.game.die_b.currentValue = 9 self.game.userInput = "b" self.game.check_user_input() self.assertNotEqual(9, self.game.die_b.currentValue, "[9, x], die_b currentValue not 9") def test_check_user_input_change_currentValue_a9_b9_roll_ab(self): """ [9, 9], does currentValue a9, b9 change after roll ab """ self.game.die_a.currentValue = 9 self.game.die_b.currentValue = 9 self.game.userInput = "ab" self.game.check_user_input() self.assertNotEqual(9, self.game.die_a.currentValue, "[9, 9], die_a currentValue not 9") self.assertNotEqual(9, self.game.die_b.currentValue, "[9, 9], die_b currentValue not 9") def test_check_user_input_change_currentValue_a9_roll_x(self): """ [9, x], does currentValue a9 remain for invalid input """ self.game.die_a.currentValue = 9 self.game.userInput = "x" self.game.check_user_input() self.assertEqual(9, self.game.die_a.currentValue, "[9, x], die_a currentValue is still 9") def test_check_user_input_change_currentValue_b9_roll_x(self): """ [x, 9], does currentValue b9 remain for invalid input """ self.game.die_b.currentValue = 9 self.game.userInput = "x" self.game.check_user_input() self.assertEqual(9, self.game.die_b.currentValue, "[x, 9], die_b currentValue is still 9") def test_check_user_input_change_currentValue_a9_b9_roll_xx(self): """ [9, 9], does currentValue a9, b9 remain for invalid input """ self.game.die_a.currentValue = 9 self.game.die_b.currentValue = 9 self.game.userInput = "xx" self.game.check_user_input() self.assertEqual(9, self.game.die_a.currentValue, "[9, 9], die_a currentValue is 9") self.assertEqual(9, self.game.die_b.currentValue, "[9, 9], die_b currentValue is 9") def test_check_user_input_change_currentValue_a9_roll_ax(self): """ [9, x], does currentValue a9 change for mix input """ self.game.die_a.currentValue = 9 self.game.userInput = "xax" self.game.check_user_input() self.assertNotEqual(9, self.game.die_a.currentValue, "[9, x], die_a currentValue not 9") def test_check_user_input_change_currentValue_b9_roll_bx(self): """ [x, 9], does currentValue b9 change for mix input """ self.game.die_b.currentValue = 9 self.game.userInput = "xbx" self.game.check_user_input() self.assertNotEqual(9, self.game.die_b.currentValue, "[x, 9], die_b currentValue not 9") def test_check_user_input_change_currentValue_a9_b9_roll_xabx(self): """ [9, 9], does currentValue a9, b9 change for mix input """ self.game.die_a.currentValue = 9 self.game.die_b.currentValue = 9 self.game.userInput = "xabx" self.game.check_user_input() self.assertNotEqual(9, self.game.die_a.currentValue, "[9, 9], die_a currentValue not 9") self.assertNotEqual(9, self.game.die_b.currentValue, "[9, 9], die_b currentValue not 9")
def setUp(self): self.new_game = AngryDice(False) print(self.shortDescription())
class ParseInputTest(unittest.TestCase): """Tests clean_input function of the angry_dice module""" def setUp(self): self.new_game = AngryDice(False) print(self.shortDescription()) @patch('builtins.input', return_value='a') def test_parse_single_a(self, return_value): """ tests the function correctly respond with 'a' for a single 'a' roll request""" self.assertEqual(['a'], self.new_game.parse_input()) @patch('builtins.input', return_value='aaaaaaaaaa') def test_parse_many_a(self, return_value): """ tests the function correctly respond with 'a' for many 'a' roll request""" self.assertEqual(['a'], self.new_game.parse_input()) @patch('builtins.input', return_value='aaaaccc32423432aaaaaa') def test_parse_many_a_and_others(self, return_value): """ tests the function correctly respond with 'a' for a many 'a' + invalid roll request""" self.assertEqual(['a'], self.new_game.parse_input()) @patch('builtins.input', return_value='b') def test_parse_single_b(self, return_value): """ tests the function correctly respond with 'b for a single 'b' roll request""" self.assertEqual(['b'], self.new_game.parse_input()) @patch('builtins.input', return_value='bbbbbb') def test_parse_many_a(self, return_value): """ tests the function correctly respond with 'b' for many 'b' roll request""" self.assertEqual(['b'], self.new_game.parse_input()) @patch('builtins.input', return_value='bbbccc32423432bbb') def test_parse_many_a_and_others(self, return_value): """ tests the function correctly respond with 'b' for a many 'b' + invalid roll request""" self.assertEqual(['b'], self.new_game.parse_input()) @patch('builtins.input', return_value='exit') def test_parse_single_exit(self, return_value): """ tests the function correctly respond with 'exit for a single 'b' roll request""" self.assertEqual(['exit'], self.new_game.parse_input()) @patch('builtins.input', return_value='exitexitexit') def test_parse_many_exit(self, return_value): """ tests the function correctly respond with 'exit' for many 'exit' roll request""" self.assertEqual(['exit'], self.new_game.parse_input()) @patch('builtins.input', return_value='bbbcccexitaaa') def test_parse_many_exit_and_others(self, return_value): """ tests the function correctly respond with 'exit' for a many 'ba' + invalid roll request""" self.assertEqual(['exit'], self.new_game.parse_input()) @patch('builtins.input', return_value='e') def test_parse_invalid_request(self, return_value): """ tests the function correctly respond with '' for a 'invalid' roll request""" self.assertEqual([], self.new_game.parse_input()) @patch('builtins.input', return_value='eyetiuoewurpoewur') def test_parse_invalid_requests(self, return_value): """ tests the function correctly respond with '' for many 'invalid' roll request""" self.assertEqual([], self.new_game.parse_input())
class AngryCheckRoll(unittest.TestCase): """Tests that AngryDie's exit stage function works""" def setUp(self): self.new_game = AngryDice(False) print(self.shortDescription()) def test_stage_1_correct_exit(self): """We check if we correctly exit stage 1""" self.new_game.current_dice_a_value = 1 self.new_game.current_dice_b_value = 2 self.assertEqual(2, self.new_game.check_roll()) def test_stage_2_correct_exit(self): """We check if we correctly exit stage 2""" self.new_game.current_dice_a_value = "ANGRY" self.new_game.current_dice_b_value = 4 self.new_game.current_stage = 2 self.assertEqual(3, self.new_game.check_roll()) def test_stage_3_correct_exit(self): """We check if we correctly exit stage 3""" self.new_game.current_dice_a_value = 5 self.new_game.current_dice_b_value = 6 self.new_game.current_stage = 3 self.assertEqual(4, self.new_game.check_roll()) def test_stage_1_incorrect_dbl_exit_cond(self): """We check if we correctly stop exit stage 1 w/ two invalid cond""" self.new_game.current_dice_a_value = 5 self.new_game.current_dice_b_value = 6 self.new_game.current_stage = 1 self.assertEqual(1, self.new_game.check_roll()) def test_stage_2_incorrect_dbl_exit_cond(self): """We check if we correctly stop exit stage 2 w/ two invalid cond""" self.new_game.current_dice_a_value = 2 self.new_game.current_dice_b_value = 1 self.new_game.current_stage = 2 self.assertEqual(2, self.new_game.check_roll()) def test_stage_3_incorrect_dbl_exit_cond(self): """We check if we correctly stop exiting stage 3 w/ two invalid cond""" self.new_game.current_dice_a_value = 1 self.new_game.current_dice_b_value = 4 self.new_game.current_stage = 3 self.assertEqual(3, self.new_game.check_roll()) def test_stage_1_incorrect_single_exit_cond(self): """We check if we correctly stop exit stage 1 w/ one invalid cond""" self.new_game.current_dice_a_value = 1 self.new_game.current_dice_b_value = 6 self.new_game.current_stage = 1 self.assertEqual(1, self.new_game.check_roll()) def test_stage_2_incorrect_single_exit_cond(self): """We check if we correctly stop exit stage 2 w/ one invalid cond""" self.new_game.current_dice_a_value = "ANGRY" self.new_game.current_dice_b_value = 1 self.new_game.current_stage = 2 self.assertEqual(2, self.new_game.check_roll()) def test_stage_3_incorrect_single_exit_cond(self): """We check if we correctly stop exiting stage 3 w/ one invalid cond""" self.new_game.current_dice_a_value = 5 self.new_game.current_dice_b_value = "ANGRY" self.new_game.current_stage = 3 self.assertEqual(3, self.new_game.check_roll()) def test_mutilated_stage_conditions(self): """We mutate stage exit conditions, and check if we still work.""" self.new_game.STAGE = {1: [7, 8], 2: ['SAD', 4], 3: [10, 6]} self.new_game.current_dice_a_value = 5 self.new_game.current_dice_b_value = "ANGRY" self.new_game.current_stage = 3 self.assertEqual(3, self.new_game.check_roll())
class IsCheatTest(unittest.TestCase): """Tests is_cheat function""" def setUp(self): self.new_game = AngryDice(False) print(self.shortDescription()) def test_is_holding_a_6(self): """test if holding w/ 6 is caught""" self.new_game.current_dice_a_value = 6 self.assertTrue(self.new_game.is_cheat(["b"])) def test_is_holding_a_non_stage_1_value(self): """test if holding a value not in the current stage 1 exit cond""" self.new_game.current_dice_a_value = "ANGRY" self.new_game.current_stage = 1 self.assertTrue(self.new_game.is_cheat(["b"])) def test_is_holding_a_with_stage_1_value(self): """test if holding a value in stage 1 can be held""" self.new_game.current_dice_a_value = 1 self.assertFalse(self.new_game.is_cheat(["b"])) def test_is_holding_a_non_stage_2_value(self): """test if holding a value not in the current stage 2 exit cond""" self.new_game.current_dice_a_value = 1 self.new_game.current_stage = 2 self.assertTrue(self.new_game.is_cheat(["b"])) def test_is_holding_a_with_stage_2_value(self): """test if holding a value in stage 2, that can be held""" self.new_game.current_dice_a_value = "ANGRY" self.new_game.current_stage = 2 self.assertFalse(self.new_game.is_cheat(["b"])) def test_is_holding_a_non_stage_3_value(self): """test if holding a value not in the current stage 3 exit cond""" self.new_game.current_dice_a_value = 1 self.new_game.current_stage = 3 self.assertTrue(self.new_game.is_cheat(["b"])) def test_is_holding_a_with_stage_3_value(self): """test if holding a value for stage 3 can be held""" self.new_game.current_dice_a_value = 5 self.new_game.current_stage = 3 self.assertFalse(self.new_game.is_cheat(["b"])) def test_is_holding_b_6(self): """test if holding b w/ 6 is caught""" self.new_game.current_dice_b_value = 6 self.assertTrue(self.new_game.is_cheat(["a"])) def test_is_holding_b_non_stage_1_value(self): """test if holding a value not in the current stage exit cond""" self.new_game.current_dice_b_value = "ANGRY" self.new_game.current_stage = 1 self.assertTrue(self.new_game.is_cheat(["a"])) def test_is_holding_b_with_stage_1_value(self): """test if holding b value in stage, can be held""" self.new_game.current_dice_b_value = 1 self.assertFalse(self.new_game.is_cheat(["a"])) def test_is_holding_b_non_stage_2_value(self): """test if holding b value not in the current stage 2 exit cond""" self.new_game.current_dice_b_value = 1 self.new_game.current_stage = 2 self.assertTrue(self.new_game.is_cheat(["a"])) def test_is_holding_b_with_stage_2_value(self): """test if holding b value from stage 2, can be held""" self.new_game.current_dice_b_value = "ANGRY" self.new_game.current_stage = 2 self.assertFalse(self.new_game.is_cheat(["a"])) def test_is_holding_b_non_stage_3_value(self): """test if holding b value not in the current stage 3 exit cond""" self.new_game.current_dice_b_value = 1 self.new_game.current_stage = 3 self.assertTrue(self.new_game.is_cheat(["a"])) def test_is_holding_b_with_stage_3_value(self): """test if holding b value from stage 3, can be held""" self.new_game.current_dice_b_value = 5 self.new_game.current_stage = 3 self.assertFalse(self.new_game.is_cheat(["a"])) def test_check_if_input_isnt_list(self): """test if the cheat f() isn't passed a list.""" try: self.new_game.is_cheat(3) except TypeError: self.assertTrue(True) else: self.assertTrue(False, "The correct error type wasn't raised")