Rather than directly into the interpreter, tests are typically written in the same file or a neighboring file with the suffix _test.py .
Tags
#python #sicp
Question
Where are tests normally written?
Answer
?
Tags
#python #sicp
Question
Where are tests normally written?
Answer
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 original toplevel document below and click on "Move attachment"
Parent (intermediate) annotation
Open it 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 .
Original toplevel document
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 learned
measured difficulty
37% [default]
last interval [days]
repetition number in this series
0
memorised on
scheduled repetition
scheduled repetition interval
last repetition or drill
Details
No repetitions
Discussion
Do you want to join discussion? Click here to log in or create user.