This script includes examples of logging, using breakpoints, and reproducing a simple bug for practice
Key Concepts Demonstrated in the Script
-
Logging in Python: The script uses Python’s logging module to record debug, info, error, and warning messages. This helps track the flow of execution and diagnose issues.
-
Reproduce the Bug: The script intentionally includes a division by zero bug to demonstrate how to identify and fix it.
-
Breakpoints: You can set a breakpoint in your IDE at the line where
result = divide_numbers(num1, num2)
to inspect the values ofnum1
andnum2
. -
Automated Testing: The script includes a simple assertion to test the
divide_numbers
function, ensuring it behaves as expected. -
Static Analysis: The commented line
unused_variable = 42
can be used to simulate a static analysis warning for an unused variable.