本文整理汇总了Python中position.Position.compare_orient方法的典型用法代码示例。如果您正苦于以下问题:Python Position.compare_orient方法的具体用法?Python Position.compare_orient怎么用?Python Position.compare_orient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类position.Position
的用法示例。
在下文中一共展示了Position.compare_orient方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_compare
# 需要导入模块: from position import Position [as 别名]
# 或者: from position.Position import compare_orient [as 别名]
def test_compare(self):
pos = Position(5, 5)
pos_top = Position(4, 5)
pos_bottom = Position(6, 5)
pos_right = Position(5, 6)
pos_left = Position(5, 4)
pos_tests = [pos_left, pos_right, pos_bottom, pos_top]
self.assertEquals(pos.compare_orient(pos_top), Orientation.top)
self.assertEquals(pos.compare_orient(pos_bottom), Orientation.bottom)
self.assertEquals(pos.compare_orient(pos_left), Orientation.left)
self.assertEquals(pos.compare_orient(pos_right), Orientation.right)
for pos_case in pos_tests:
self.assertEquals(pos.distance(pos_case), 1)