本文整理汇总了Python中space.space函数的典型用法代码示例。如果您正苦于以下问题:Python space函数的具体用法?Python space怎么用?Python space使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了space函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_constructors
def test_constructors(self):
"""Test space constructors"""
a = space.space()
self.assertEqual(a.x, 0)
self.assertEqual(a.y, 0)
self.assertEqual(a.z, 0)
self.assertSpaceAreEqual(a, space.Uo)
a = space.space(self.x1)
self.assertEqual(a.x, self.x1)
self.assertEqual(a.y, 0)
self.assertEqual(a.z, 0)
a = space.space(self.x1, self.y1)
self.assertEqual(a.x, self.x1)
self.assertEqual(a.y, self.y1)
self.assertEqual(a.z, 0)
a = space.space(self.x1, self.y1, self.z1)
self.assertSpaceAreEqual(self.space1, a)
a = space.space(z=self.z2, x=self.x2, y=self.y2)
self.assertSpaceAreEqual(self.space2, a)
示例2: test_add
def test_add(self):
"""Test add"""
a = space.space(self.A, self.B, self.C)
b = space.space(-self.A, -self.B, -self.C)
c = a + b
self.assertEqual(0, c.x)
self.assertEqual(0, c.y)
self.assertEqual(0, c.z)
示例3: test_space_noop_richcompare_space
def test_space_noop_richcompare_space(self):
"""Test space >, >=, <, <= space"""
a = space.space(1, 2, 3)
b = space.space(4, 5, 5)
self.assertRaises(TypeError, lambda a, b: a > b)
self.assertRaises(TypeError, lambda a, b: a >= b)
self.assertRaises(TypeError, lambda a, b: a < b)
self.assertRaises(TypeError, lambda a, b: a <= b)
示例4: test_copy_constructor
def test_copy_constructor(self):
"""Test space copy constructor"""
a = space.space(self.A, self.B, self.C)
b = space.space(a)
self.assertEqual(self.A, b.x)
self.assertEqual(self.B, b.y)
self.assertEqual(self.C, b.z)
示例5: test_subtract
def test_subtract(self):
"""Test subtract"""
a = space.space(self.A, self.B, self.C)
b = space.space(self.A, self.B, self.C)
c = a - b
self.assertEqual(c.x, 0)
self.assertEqual(c.y, 0)
self.assertEqual(c.z, 0)
示例6: test_prints
def test_prints(self):
"""Test space print and repr"""
a = space.space(self.x2, self.y2, self.z2)
self.assertEqual(self.two_as_str, str(a))
self.assertEqual(self.two_as_repr, repr(a))
示例7: test_copy_assign_2
def test_copy_assign_2(self):
"""Test copy assignment operator is shallow"""
a = space.space(1,2,3)
b = a
b.x(4.0)
self.assertTrue(a == b)
self.assertEqual(4, b.x())
示例8: test_xyz_assignments
def test_xyz_assignments(self):
"""Test space xyz assignment operators"""
a = space.space()
a.x(self.p1.x())
a.y(self.p1.y())
a.z(self.p1.z())
self.assertTrue(self.p1 == a)
示例9: test_space_minus_space
def test_space_minus_space(self):
"""Test space - space"""
result = space.space(self.p1.x() - self.p2.x(),
self.p1.y() - self.p2.y(),
self.p1.z() - self.p2.z())
a = self.p1 - self.p2
self.assertTrue(result == a)
示例10: test_space_plus_space
def test_space_plus_space(self):
"""Test space + space"""
result = space.space(self.p1.x() + self.p2.x(),
self.p1.y() + self.p2.y(),
self.p1.z() + self.p2.z())
a = self.p1 + self.p2
self.assertTrue(result == a)
示例11: test_divide
def test_divide(self):
"""Test divide (scale)"""
result = space.space(self.p1.x / 2.0,
self.p1.y / 2.0,
self.p1.z / 2.0)
a = self.p1 / 2.0
self.assertTrue(result == a)
示例12: test_unitary_minus
def test_unitary_minus(self):
"""Test space = -space"""
result = space.space(-self.p1.x,
-self.p1.y,
-self.p1.z)
a = -self.p1
self.assertTrue(result == a)
示例13: test_space_eq_space
def test_space_eq_space(self):
"""Test space == space"""
result = space.space(self.p1.x + self.p2.x,
self.p1.y + self.p2.y,
self.p1.z + self.p2.z)
a = self.p1 + self.p2
self.assertTrue(result == a)
示例14: test_default_constructor
def test_default_constructor(self):
"""Test default constructor"""
a = space.space()
self.assertEqual(0, a.x)
self.assertEqual(0, a.y)
self.assertEqual(0, a.z)
self.assertTrue(space.Uo == a)
示例15: createSpaces
def createSpaces(self):
for x in range(8):
List = []
for y in range(8):
List.append(space(y,x))
self.spaces.append(List)
self.spaces.reverse()