lundi 20 février 2017

Testing. self.assertEqual one or another

In python tests I know how to check the expecting value of a variable:

def test_smth(self):
    var = 4
    self.assertEqual(var, 4)

But is it possible to check with one or another variable without flooding code with if?

Smth pretty like following (not valid example):

def test_smth(self):
    var = 5
    self.assertEqual(var, 4 or 5)

Aucun commentaire:

Enregistrer un commentaire