当前位置: 首页>>代码示例>>Python>>正文


Python space.space函数代码示例

本文整理汇总了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)
开发者ID:vmlaker,项目名称:CartesianSpace,代码行数:25,代码来源:test_space.py

示例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)
开发者ID:vmlaker,项目名称:CartesianSpace,代码行数:8,代码来源:test_space.py

示例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)
开发者ID:lrmcfarland,项目名称:CartesianSpace,代码行数:8,代码来源:test_space.py

示例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)
开发者ID:vmlaker,项目名称:CartesianSpace,代码行数:8,代码来源:test_space.py

示例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)
开发者ID:vmlaker,项目名称:CartesianSpace,代码行数:8,代码来源:test_space.py

示例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))
开发者ID:vmlaker,项目名称:CartesianSpace,代码行数:7,代码来源:test_space.py

示例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())
开发者ID:lrmcfarland,项目名称:CartesianSpace,代码行数:7,代码来源:test_space.py

示例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)
开发者ID:lrmcfarland,项目名称:CartesianSpace,代码行数:7,代码来源:test_space.py

示例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)
开发者ID:lrmcfarland,项目名称:CartesianSpace,代码行数:7,代码来源:test_space.py

示例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)
开发者ID:lrmcfarland,项目名称:CartesianSpace,代码行数:7,代码来源:test_space.py

示例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)
开发者ID:lrmcfarland,项目名称:CartesianSpace,代码行数:7,代码来源:test_space.py

示例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)
开发者ID:lrmcfarland,项目名称:CartesianSpace,代码行数:7,代码来源:test_space.py

示例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)
开发者ID:lrmcfarland,项目名称:CartesianSpace,代码行数:7,代码来源:test_space.py

示例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)
开发者ID:lrmcfarland,项目名称:CartesianSpace,代码行数:7,代码来源:test_space.py

示例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()
开发者ID:seebreeze35,项目名称:Chameleon-Checkers,代码行数:7,代码来源:board.py


注:本文中的space.space函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。