本文整理汇总了Python中arena.Arena.corner_location方法的典型用法代码示例。如果您正苦于以下问题:Python Arena.corner_location方法的具体用法?Python Arena.corner_location怎么用?Python Arena.corner_location使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类arena.Arena
的用法示例。
在下文中一共展示了Arena.corner_location方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ArenaTests
# 需要导入模块: from arena import Arena [as 别名]
# 或者: from arena.Arena import corner_location [as 别名]
class ArenaTests(unittest.TestCase):
def setUp(self):
self._arena = Arena(8, 8)
def testCorner0(self):
p = self._arena.corner_location(0)
util.assertEqual(Point(0,0), p)
def testCorner1(self):
p = self._arena.corner_location(1)
util.assertEqual(Point(0,8), p)
def testCorner2(self):
p = self._arena.corner_location(2)
util.assertEqual(Point(8,8), p)
def testCorner3(self):
p = self._arena.corner_location(3)
util.assertEqual(Point(8,0), p)
def test_limits_origin(self):
p = Point(0,0)
valid = self._arena.position_valid(p)
util.assertTrue(valid)
def test_limits_max(self):
p = Point(8, 8)
valid = self._arena.position_valid(p)
util.assertTrue(valid)
def test_limits_neg(self):
p = Point(8, -8)
valid = self._arena.position_valid(p)
util.assertFalse(valid)
def test_limits_pos(self):
p = Point(8, 16)
valid = self._arena.position_valid(p)
util.assertFalse(valid)
def test_limits_neg2(self):
p = Point(-8, 0)
valid = self._arena.position_valid(p)
util.assertFalse(valid)
def test_limits_pos2(self):
p = Point(16, 0)
valid = self._arena.position_valid(p)
util.assertFalse(valid)
示例2: ArenaTests
# 需要导入模块: from arena import Arena [as 别名]
# 或者: from arena.Arena import corner_location [as 别名]
class ArenaTests(unittest.TestCase):
def setUp(self):
self._arena = Arena(8, 8)
def testCorner0(self):
p = self._arena.corner_location(0)
util.assertEqual(Point(0, 0), p)
def testCorner1(self):
p = self._arena.corner_location(1)
util.assertEqual(Point(0, 8), p)
def testCorner2(self):
p = self._arena.corner_location(2)
util.assertEqual(Point(8, 8), p)
def testCorner3(self):
p = self._arena.corner_location(3)
util.assertEqual(Point(8, 0), p)