python (12.9k questions)
javascript (9.2k questions)
reactjs (4.7k questions)
java (4.2k questions)
java (4.2k questions)
c# (3.5k questions)
c# (3.5k questions)
html (3.3k questions)
Python unit test that nothing was executed
In a method that looks like:
def my_method(p):
if p == 5:
return
elif p == 6:
do_something()
return
else:
do_something_different()
return
How do I ...

Katu
Votes: 0
Answers: 1
Can I use side_effect in my mocking to provide an indefinite number of values?
So I can use an iterable with side_effect in python mock to produce changing values returned by my calls to the mock:
some_mock.side_effect = [1, 2, 3]
return_value provides the same value every time...
Jed Godsey
Votes: 0
Answers: 1
How to patch a function of a global singleton to return a specified value given a specified input?
File c.py has a global variable COBJ of an instance of C (Singleton)
class Singleton(type):
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:
...
ca9163d9
Votes: 0
Answers: 1