I have to write some tests to assert certain functions are called, such as the plot
function from matplotlib.pyplot
. Here's the code I have so far:
def test_plot_call(self):
with patch("matplotlib.pyplot.plot") as plot_call:
import attempt
plot_call.assert_has_calls([call(attempt.X,attempt.Y1)])
This is to test that matplotlib.pyplot.plot
has been called in a certain way from a module called attempt
.
This works fine if the function is called as matplotlib.pyplot.plot(X,Y1)
, but I need it to also work when the attempt
module has called plot
like this:
from pylab import *
X = # somethin
Y1 = # somethin
plot(X,Y1)
This causes test_plot_call
to fail, but I need it to pass.
Aucun commentaire:
Enregistrer un commentaire