Can I perform multiple assertions in pytest?

后端 未结 5 1874
轻奢々
轻奢々 2020-12-25 15:24

I\'m using pytest for my selenium tests and wanted to know if it\'s possible to have multiple assertions in a single test?

I call a function that compares multiple v

5条回答
  •  独厮守ぢ
    2020-12-25 15:41

    Here's a rather simplistic approach:

    def test_sample(texts):
    flag = True
    for text in texts:
        if text != "anything":
            flag = False
    if flag==False:
        pytest.fail("text did not match", pytrace=True)
        
    

提交回复
热议问题