This repository contains Python scripts to automate tests for most of the CS50’s Introduction to Artificial Intelligence with Python projects.
It does not contain any project solution/spoiler, as per the course's Academic Honesty policy.
## How to Run Tests
- Make sure you have Python3 installed in your machine. Anything above
Python 3.4+should work.
pip install pytestin a terminal. More information about
- Make a copy of the test file and paste it in the same folder as the project that you want to test.
For example, if you want to test your code for
degrees.py, make a copy of
degrees_test.pyin the same folder as your
degrees.pyand other files that came along with the project, like
- Navigate to the project folder and run
pytest <project>_test.pyin a terminal.
For example, navigate to
? Useful pytest Flags
pytest -sto show print statements in the console
pytest -vvfor verbose mode
- Combine both flags
pytest -s -vvfor extra verbose mode
pytest --durations=nto see the
nslowest execution time
pipand then run
pytest --count nto repeat the test for n times
? My Setup
Each test should take less than 30 seconds, depending on Python's I/O and your code efficiency.
- Windows 10 Home Build 19042
- Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
- Python 3.9.5 64-bit
- Visual Studio Code w/Pylance (latest release)
I am currently auditing this course, more solutions and test cases will be added in the near future!
Feel free to create an issue if you want to contribute to the repo!
This is a student-initiated project. Passing these test cases does not guarantee that you will receive a full grade from the official CS50 AI's teaching team.