def test_plot_explicit(self, new_axis_mock):
nodes = np.asfortranarray([
[0.0, 0.0],
[1.0, 1.0],
])
curve = self._make_one(nodes, 1, _copy=False)
num_pts = 2 # This value is crucial for the plot call.
ax = unittest.mock.Mock(spec=['plot'])
color = (0.75, 1.0, 1.0)
alpha = 0.625
result = curve.plot(num_pts, color=color, alpha=alpha, ax=ax)
self.assertIs(result, ax)
# Verify mocks.
new_axis_mock.assert_not_called()
# Check the call to ax.plot(). We can't assert_any_call()
# since == breaks on NumPy arrays.
self.assertEqual(ax.plot.call_count, 1)
call = ax.plot.mock_calls[0]
utils.check_plot_call(self, call, nodes, color=color, alpha=alpha)
评论列表
文章目录