pytest

筆記種類
pytest

 

 


def test_add_two():
    x = 1
    y = 2
    assert x + y == 3
    # assert 代表斷言,在後面的條件為false觸發異常


def test_dict_contain():
    x = {"a": 3,"b":2}

    excepted = {}    
    # 判斷有沒有在這裡面

    assert excepted.items() <= x.items()