test_curve.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:bezier 作者: dhermes 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号