Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from path.Bar import Bar
- class Foo:
- def __init__ ():
- self.bar_val = Bar()
- def func_under_test():
- ...
- if not self.bar_val.get_func2():
- ..
- else:
- ...
- return
- class Bar:
- value2 = ...
- def __init__ ():
- pass
- def get_func1()
- ...
- return
- def get_func2()
- ...
- return value2
- class TestFoo:
- @patch('dateipfad+name.Foo.Bar.get_func1')
- @patch('dateipfad+name.Foo.Bar.get_func2')
- def interessant(self, mocked_get_func1, mocked_get_func_2):
- mocked_get_func1.return_vaue = '{"a":"b"}'
- mocked_get_func2.return_vaue = None
- self.assert...()
- self.assert...()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement