test_geometry.py 文件源码

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

项目:pygorithm 作者: OmkarPathak 项目源码 文件源码
def test_from_regular_center(self):
        for i in range(3, 13):
            _poly = polygon2.Polygon2.from_regular(i, 1)

            foundx0 = False
            foundy0 = False
            for p in _poly.points:
                if math.isclose(p.x, 0, abs_tol=1e-07):
                    foundx0 = True
                    if foundy0:
                        break
                if math.isclose(p.y, 0, abs_tol=1e-07):
                    foundy0 = True
                    if foundx0:
                        break
            helpmsg = "\ni={}\nfoundx0={}, foundy0={}, center={}\nrepr={}\n\nstr={}".format(i, foundx0, foundy0, _poly.center, repr(_poly), str(_poly))
            self.assertTrue(foundx0, msg=helpmsg)
            self.assertTrue(foundy0, msg=helpmsg)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号