I cannot replicate what I am seeing in Figure 4, Ch 6, with regards to doctest.
I =think= I am running a duplicate of the code listing for temperature_program.py. When I import it into IDLE (I am running python 3.4.1), first I don’t see the default actions take place (because it is running as a module, not from the command line, I presumed), so that doesn’t match Fig. 4.
When I import and run doctest, I get “attempted=0”, not “attempted=1” as shown in the diagram. This makes sense, because no test appears to be running. It also indicates that I am doing something differently.
In your test, you note that: TestResults(failed=0, attempted=1) indicates that three tests were run. Is that a typo? There =are= three tests in the file.
following some direction on the web, if I add “import doctest” into my temperature_program.py, and then place the line, “doctest.testmod()” as the first item after the “if … main” and run the module from the command line, I get a. nothing returned when the code is correct–which both python and wikipedia say is correct when run via CLI b. an appropriate error message when I follow the text and remove the parens that make the conversion to celsius work correctly.
So, I think my code is generally correct, but something is happening in IDLE that I have configured differently/incorrectly such that what I observe does not match the text.