test__geometric_intersection.py 文件源码

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

项目:bezier 作者: dhermes 项目源码 文件源码
def test_workspace_too_small(self):
        from bezier import _curve_intersection_speedup

        nodes1 = np.asfortranarray([
            [-3.0, 0.0],
            [5.0, 0.0],
        ])
        nodes2 = np.asfortranarray([
            [-7.0, -9.0],
            [9.0, 13.0],
            [-7.0, -13.0],
            [9.0, 9.0],
        ])
        # NOTE: These curves intersect 3 times, so a workspace of
        #       2 is not large enough.
        self.reset_workspace(2)
        with self.assertRaises(ValueError) as exc_info:
            self._call_function_under_test(
                nodes1, nodes2, allow_resize=False)

        exc_args = exc_info.exception.args
        expected = _curve_intersection_speedup.TOO_SMALL_TEMPLATE.format(3, 2)
        self.assertEqual(exc_args, (expected,))
        # Make sure the workspace was **not** resized.
        self.assertEqual(self.workspace_size(), 2)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号