I am trying to test a class method which is called within an init function.
class abc:
def __init__(path):
list = []
foo(path)
bar('hello') # test function bar
def foo(self, path):
# does a bunch of stuff and creates internal list
list =
def bar(self):
# does a bunch of stuff and uses list
I would like to write a test for method bar
here which I guess must be called through an object of class abc
. I can mock list array for this test, but cannot understand how to avoid the call to foo()
.
Aucun commentaire:
Enregistrer un commentaire