test_curve.py 文件源码

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

项目:bezier 作者: dhermes 项目源码 文件源码
def test_length_property_not_cached(self):
        nodes = np.asfortranarray([
            [0.0, 0.0],
            [1.0, 2.0],
        ])
        curve = self._make_one(nodes, 1)
        self.assertIsNone(curve._length)

        patch = unittest.mock.patch(
            'bezier._curve_helpers.compute_length',
            return_value=unittest.mock.sentinel.length)
        with patch as mocked:
            self.assertEqual(curve.length, unittest.mock.sentinel.length)

            self.assertEqual(mocked.call_count, 1)
            call = mocked.mock_calls[0]
            _, positional, keyword = call
            self.assertEqual(keyword, {})
            self.assertEqual(len(positional), 1)
            self.assertEqual(positional[0], nodes)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号