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.



Tags
#python #sicp
Question
What is run_docstring_examples fuction used for?
Answer
To verify the doctest interactions for only a single function

Tags
#python #sicp
Question
What is run_docstring_examples fuction used for?
Answer
?

Tags
#python #sicp
Question
What is run_docstring_examples fuction used for?
Answer
To verify the doctest interactions for only a single function
If you want to change selection, open original toplevel document below and click on "Move attachment"

Parent (intermediate) annotation

Open it
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

Original toplevel document

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 learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised 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.