mardi 26 janvier 2016

mocking/patching an object of a different function

Suppose I have

def foo:
    return a()

def bar:
    someObject = someObjectFactory()
    if someObject.field: 
       #do something

What if I want to change the value of someObject.field when I call foo. Foo is a test and basically I want to be able to change someObject.field to test different values.

Aucun commentaire:

Enregistrer un commentaire