🧪 Testing & Debugging
doctest
Tests live inside your docstrings.
doctest scans docstrings for interactive examples and runs them as tests. Documentation and tests stay in sync.
def square(n):
"""
>>> square(3)
9
"""
return n * n
🧪 Testing & Debugging
Tests live inside your docstrings.
doctest scans docstrings for interactive examples and runs them as tests. Documentation and tests stay in sync.
def square(n):
"""
>>> square(3)
9
"""
return n * n
Press Run to execute.attempted=1 failed=0
Sign in to track your progress across lessons.