Skip to content

Instantly share code, notes, and snippets.

@KentaYamada
Created August 11, 2016 08:38
Show Gist options
  • Save KentaYamada/21f595bb03aeb8592984dd1d2f4533e2 to your computer and use it in GitHub Desktop.
Save KentaYamada/21f595bb03aeb8592984dd1d2f4533e2 to your computer and use it in GitHub Desktop.
今さらdoctest使ってみた
# -*-coding: utf-8 -*-
def hoge(n):
return n * 2
def piyo():
return "Hello."
def test_hoge():
"""
Hoge関数のテスト
>>> hoge(2)
4
piyo関数のテスト
>>> piyo()
'Hello.'
"""
if __name__ == "__main__":
import doctest
doctest.testmod()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment