Created
June 24, 2015 11:52
-
-
Save hitsumabushi/8496cee5decf22f39585 to your computer and use it in GitHub Desktop.
doctestでprint文を無視する場合の例
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = 0 | |
def f(): | |
""" 適当にTrueが返る | |
>>> sys.stdout.write("magic comment:"); f() # doctest:+ELLIPSIS | |
magic comment:... | |
True | |
""" | |
for s in range(0, 2): | |
print(s) | |
return True | |
print(x) | |
if __name__ == "__main__": | |
import doctest | |
import sys | |
doctest.testmod(optionflags=doctest.ELLIPSIS) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment