def test_plot_wrong_dimension(self): nodes = np.asfortranarray([ [0.0, 0.0, 0.0], [1.0, 3.0, 4.0], ]) curve = self._make_one(nodes, 1) with self.assertRaises(NotImplementedError): curve.plot(32)
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)
def test_plot_explicit(self, new_axis_mock): nodes = np.asfortranarray([[0.0, 1.0], [0.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)