mardi 28 juillet 2020

How do I approach this python test?

I have a function inside a class, that calls other functions and does some stuff until it obtains two variables, A and B:

Class NumberLogic:
    def compare():
    #do stuff_
    A=#do stuff__
    B=#do stuff___
    if A<B:
        return 1
    else:
        return 2

I would like to test this function compare() but give values directly from A and B so only the if condition is tested, I am not sure if this is possible and the rest of the code can be mocked so when I call someting like

assert 1 == NumberLogic.compare()

Aucun commentaire:

Enregistrer un commentaire