Last active
February 14, 2017 03:53
-
-
Save KentaYamada/4f024bf43fd1cfaa324e1330519c7cdc to your computer and use it in GitHub Desktop.
Unit testデータサンプル
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
import unittest | |
from utility import from_json # ラッパー関数があると便利かも | |
class TestSample(unittest.TestCase): | |
def test_save_ok(self): | |
test_case = from_json("test_save_ok") | |
for d in test_case['data']: | |
self.assertEqual(test_case['expected'], d) | |
if __name__ == "__main__": | |
unittest.main() |
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
{ | |
"test_save_ok": { | |
"expected": true, | |
"data": [ | |
] | |
}, | |
"test_save_ng": { | |
"expected": true, | |
"data": [ | |
] | |
}, | |
"test_validation_ok": { | |
"expected": true, | |
"data": [ | |
] | |
}, | |
"test_validation_ng": { | |
"expected": false, | |
"data": [ | |
] | |
}, | |
"test_find_all_ok": { | |
"expected": 10, | |
"data": [ | |
] | |
}, | |
"test_find_any_ok": { | |
"expected": "Tom", | |
"data": [ | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment