A shared folder with AI prompts and code snippets
From workspace: FreeCodeCamp
Team: Main
Total snippets: 6
6 snippets
Group multiple assertions in a single test function.
def test_numbers(): assert 1 + 1 == 2 assert 2 * 2 == 4 assert 3 - 1 == 2
Follow Pytest’s naming convention for test discovery.
# Use files starting with 'test_' # Example: test_math.py
Discover and run all tests using the CLI.
pytest
A minimal test function using Pytest with assert.
def test_addition(): assert 2 + 2 == 4
Install the Pytest package using pip in a virtual environment.
pip install pytest
link to cource
https://www.freecodecamp.org/news/how-to-use-pytest-a-guide-to-testing-in-python/