def hello():I can simply press LC's "docTest" button or "verbose" button to run Python with doctest.
""">>> hello()
Hello!
"""
print "Hello!"
What's happening behind the scene is that the following two lines
import doctestare appended to the code in the window, all of which is saved to a file which is then executed by Python, with or without the "-v" option. The result is saved to a second file which is then displayed in LC's output window.
doctest.testmod()
Granted, if your script already includes some doctest-based testing within a "standard"
if __name__ == "__main__:"block, this addition to LC may not seem that useful; however, if you already use the "if..." block for something other than tests with doctest and have some docstrings-based tests in your code, it might be worth your while trying LC's new feature.
No comments:
Post a Comment
Spammers: none shall pass.
Note: Only a member of this blog may post a comment.