일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- GitHub
- Numpy
- index
- E-P1
- SPL
- pip
- mean
- pycharm
- mariadb
- SciPy
- RNN
- pandas
- Splunk
- CNN
- javascript
- 삼성소프트웨어멤버십
- GT-S80
- Button
- imread
- LSTM
- ipad
- synology
- dataframe
- Python
- keras
- Lotto
- install
- Series
- DFS
- 알고리즘
Archives
- Today
- Total
잠토의 잠망경
[python] unitest 본문
pycharm에서는 실행에 unitest 부분이 있다.
이걸로 실행한다.
sample code
def add(a, c):
return a+c
def mul(a, c):
return a*c
def divided(a, c):
return a/c
test code
import unittest
import sample.myCalc as myCalc
class myCalcTest(unittest.TestCase):
def test_add(self):
c = myCalc.add(10, 30)
self.assertEqual(c, 40)
def test_mul(self):
c = myCalc.mul(10, 30)
self.assertEqual(c, 300)
def test_divided(self):
c = myCalc.divided(10, 30)
self.assertEqual(c, 0)
if __name__ == '__main__':
unittest.main()
Comments