unit test

Domain: Testing Quality

🎯 Motivation

A unit test verifies a single function or method in isolation. Unit tests are fast, focused, and form the foundation of a healthy test pyramid, catching logic errors at the smallest level.

πŸ“‹ Concrete Example

You test def is_even(n) with assert is_even(4) is True and assert is_even(3) is False, checking only the function’s logic without any database or network.

πŸ”— Analogy

A unit test is like checking each brick individually before building a wall. If the bricks are solid, the wall is more likely to stand.