Jupyter学習ノート_007
google colabにpytestを試して見る
下記の手順で実施する
- ソースコードを用意する
- ネーミングルール
- 「test」で始まるメソッドにする
- 結果がOKかNGかはassert条件式の結果より判断する
- ネーミングルール
pytest01.py
def add(a, b):
return a + b
def sub(a, b):
return a - b
test_pytest01.py
from pytest01 import add, sub
def test_add():
assert add(1, 2) == 4 # NGになる
def test1_sub():
assert sub(3, 1) == 2 # OKになる
def atest_sub():
assert sub(3, 1) == 2 # pytestが認識できない
Author And Source
この問題について(Jupyter学習ノート_007), 我々は、より多くの情報をここで見つけました https://qiita.com/dmkd3006/items/f4f773635c4c5ede2e22著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .