Created
May 21, 2016 13:41
-
-
Save KentaYamada/d803b3264c634a25f4134a29b3076a29 to your computer and use it in GitHub Desktop.
PythonでUnitTest
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
#coding -*- utf-8 -*- | |
import unittest | |
def add(x, y): | |
return x + y | |
class SampleUnitTest(unittest.TestCase): | |
#テストメソッドは先頭に必ず「test」と書く | |
def test_add(self): | |
result = add(1, 2) | |
self.assertEqual(3, result) | |
if __name__ == "__main__": | |
unittest.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment