test_number_wins (__main__.CompVisTestCase) ... FAIL
test_prediction_presence (__main__.CompVisTestCase) ... FAIL
test_presence_readme (__main__.CompVisTestCase) ... FAIL
test_time_presence (__main__.CompVisTestCase) ... ok

======================================================================
FAIL: test_number_wins (__main__.CompVisTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ivanyingx/Desktop/AiCore-Teaching/Tools/Projects/marking_packages/Computer-Vision/computer_vision_test/test_milestone5_p2.py", line 75, in test_number_wins
    self.assertTrue(cond, "You should have a condition that checks if the computer or user wins or if the game is over. It can be either comparing both computer_wins and user_wins reached 3 or checking that rounds_played is 5")
AssertionError: False is not true : You should have a condition that checks if the computer or user wins or if the game is over. It can be either comparing both computer_wins and user_wins reached 3 or checking that rounds_played is 5

======================================================================
FAIL: test_prediction_presence (__main__.CompVisTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ivanyingx/Desktop/AiCore-Teaching/Tools/Projects/marking_packages/Computer-Vision/computer_vision_test/test_milestone5_p2.py", line 10, in test_prediction_presence
    self.assertIn("get_prediction(", camera_script, "You should have a function or method called get_prediction in your camera_rps.py file")
AssertionError: 'get_prediction(' not found in 'import random\nimport time\nimport cv2\nfrom keras.models import load_model\nimport numpy as np\nmodel = load_model(\'keras_model.h5\')\ncap = cv2.VideoCapture(0)\ndata = np.ndarray(shape=(1, 224, 224, 3), dtype=np.float32)\n\ndef compare_choice(prediction, player_score, computer_score):\n    options = [\'Rock\', \'Paper\', \'Scissors\', \'Nothing\']\n    \n    if prediction[0][0] > 0.5:\n        player_choice = options[0]\n    elif prediction[0][1] > 0.5:\n        player_choice = options[1]\n    elif prediction[0][2] > 0.5:\n        player_choice = options[2]\n    else:\n        player_choice = options[3]\n\n    computer_choice = random.choice(options)\n    message = ""\n\n    if computer_choice == \'Rock\':\n        if player_choice == \'Rock\':\n            message = "You and the computer both chose rock! It\'s a draw!"\n        elif player_choice == \'Paper\':\n            message = "You chose paper and the computer chose rock! You win!"\n            player_score = True\n        elif player_choice == \'Scissors\':\n            message = "You chose scissors and the computer chose rock! You lose!"\n            computer_score = True\n        else:\n            message = "Please choose either rock, paper or scissors."\n    elif computer_choice == \'Paper\':\n        if player_choice == \'Rock\':\n            message = "You chose rock and the computer chose paper! You lose!"\n            computer_score = True\n        elif player_choice == \'Paper\':\n            message = "You and the computer both chose paper! It\'s a draw!"\n        elif player_choice == \'Scissors\':\n            message = "You chose scissors and the computer chose paper! You win!"\n            player_score = True\n        else:\n            message = "Please choose either rock, paper or scissors."\n    elif computer_choice == \'Scissors\':\n        if player_choice == \'Rock\':\n            message = "You chose rock and the computer chose scissors! You win!"\n            player_score = True\n        elif player_choice == \'Paper\':\n            message = "You chose paper and the computer chose scissors! You lose!"\n            computer_score = True\n        elif player_choice == \'Scissors\':\n            message = "You and the computer both chose scissors! It\'s a draw!"\n        else:\n            message = "Please choose either rock, paper or scissors."\n    else:\n        message = "Please choose either rock, paper or scissors."\n    return message, player_score, computer_score\n\ncamera_started = False\nfirst_game = True\npress_p = False\ntime_since_P = 0\nelapsed = 0\np_score = 0\nc_score = 0\n\nwhile True:\n    ret, frame = cap.read()\n    resized_frame = cv2.resize(frame, (224, 224), interpolation = cv2.INTER_AREA)\n    image_np = np.array(resized_frame)\n    normalized_image = (image_np.astype(np.float32) / 127.0) - 1 # Normalize the image\n    data[0] = normalized_image\n    prediction = model.predict(data)\n\n    if camera_started == False:\n        camera_started = True\n        message = "Press P to play"\n    if cv2.waitKey(1) == ord("p") and camera_started == True and first_game == True and press_p == False:\n        first_game = False\n        press_p = True\n        time_since_P = time.time()\n\n    elapsed = time.time() - time_since_P\n\n    if camera_started == True and first_game == False and press_p == True and elapsed < 5:\n        message = f"Make your choice in {5 - int(elapsed)} seconds"\n\n    elif camera_started == True and first_game == False and press_p == True and elapsed > 5:\n        x = compare_choice(prediction, player_score=False, computer_score=False)\n        if x[1] == True:\n            p_score += 1\n        if x[2] == True:\n            c_score += 1\n        message = f"{x[0]} {p_score} - {c_score}"\n        press_p = False\n    elif camera_started == True and first_game == False and press_p == False and elapsed > 10:\n        message = "Press X to play again"\n    if cv2.waitKey(1) == ord("x") and camera_started == True and first_game == False and press_p == False:\n        message = "Make your choice"\n        press_p = True\n        time_since_P = time.time()\n    if p_score == 3:\n        camera_started = False\n        message = "You won! Please press q to close this window and restart."\n    if c_score == 3:\n        camera_started = False\n        message = "The computer won! Please press q to close this window and restart."\n\n    cv2.putText(frame, message, (50,50), cv2.FONT_HERSHEY_DUPLEX, 0.475, (0, 0, 255), 1)\n    cv2.imshow(\'frame\', frame)\n    if cv2.waitKey(1) & 0xFF == ord(\'q\'):\n        break\n\n# After the loop release the cap object\ncap.release()\n# Destroy all the windows\ncv2.destroyAllWindows()' : You should have a function or method called get_prediction in your camera_rps.py file

======================================================================
FAIL: test_presence_readme (__main__.CompVisTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ivanyingx/Desktop/AiCore-Teaching/Tools/Projects/marking_packages/Computer-Vision/computer_vision_test/test_milestone5_p2.py", line 81, in test_presence_readme
    self.assertGreater(len(readme), 2000, 'The README.md file should be at least 2000 characters long')
AssertionError: 1602 not greater than 2000 : The README.md file should be at least 2000 characters long

----------------------------------------------------------------------
Ran 4 tests in 0.001s

FAILED (failures=3)
