#python #sicp
When writing Python in files, rather than directly into the interpreter, tests
are typically written in the same file or a neighboring file with the suffix _test.py .
If you want to change selection, open document below and click on "Move attachment"
1.5 Control >>> def fib_test():
assert fib(2) == 1, 'The 2nd Fibonacci number should be 1'
assert fib(3) == 1, 'The 3rd Fibonacci number should be 1'
assert fib(50) == 7778742049, 'Error at the 50th Fibonacci number'
<span>When writing Python in files, rather than directly into the interpreter, tests
are typically written in the same file or a neighboring file with the suffix
_test.py .
Doctests. Python provides a convenient method for placing simple tests
directly in the docstring of a function. The first line of a docstring should
contain a one-line description of Summary
status | not read | | reprioritisations | |
---|
last reprioritisation on | | | suggested re-reading day | |
---|
started reading on | | | finished reading on | |
---|
Details