def test_plot_defaults(self, new_axis_mock):
ax = unittest.mock.Mock(spec=['plot'])
new_axis_mock.return_value = ax
nodes = np.asfortranarray([
[0.0, 1.0],
[1.0, 3.0],
])
curve = self._make_one(nodes, 1, _copy=False)
num_pts = 2 # This value is crucial for the plot call.
result = curve.plot(num_pts)
self.assertIs(result, ax)
# Verify mocks.
new_axis_mock.assert_called_once_with()
# 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=None, alpha=None)
评论列表
文章目录