Do you want BuboFlash to help you learning these things? Or do you want to add or correct something? Click here to log in or create user.



#python #sicp
To verify the doctest interactions for only a single function, we use a doctest function called run_docstring_examples . This function is (unfortunately) a bit complicated to call. Its first argument is the function to test. The second should always be the result of the expression globals() , a built-in function that returns the global environment. The third argument is True to indicate that we would like "verbose" output: a catalog of all tests run.
If you want to change selection, open document below and click on "Move attachment"

1.5 Control
the globals function returns a representation of the global environment, which the interpreter needs in order to evaluate expressions. >>> from doctest import testmod >>> testmod() TestResults(failed=0, attempted=2) <span>To verify the doctest interactions for only a single function, we use a doctest function called run_docstring_examples . This function is (unfortunately) a bit complicated to call. Its first argument is the function to test. The second should always be the result of the expression globals() , a built-in function that returns the global environment. The third argument is True to indicate that we would like "verbose" output: a catalog of all tests run. >>> from doctest import run_docstring_examples >>> run_docstring_examples(sum_naturals, globals(), True) Finding tests in NoName Trying: sum_naturals(10) Expecti


Summary

statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on

Details



Discussion

Do you want to join discussion? Click here to log in or create user.