def test___init__1(self): """ Generic testing that no exception is thrown. Test tag: <tc>#tests#Chain.__init__</tc> """ c = Chain([Point((0, 0))]) c = Chain([[Point((0, 0)), Point((1, 1))], [Point((2, 5))]])
def test_parts1(self): """ Generic testing of parts functionality. Test tag: <tc>#tests#Chain.parts</tc> """ vertices = [Point((0, 0)), Point((1, 1)), Point((2, 5)), Point((0, 0)), Point((1, 1)), Point((2, 5))] self.assertEquals(Chain(vertices).parts, [vertices]) vertices = [[Point((0, 0)), Point((1, 1)), Point((2, 5))], [Point((0, 0)), Point((1, 1)), Point((2, 5))]] self.assertEquals(Chain(vertices).parts, vertices)
def test_vertices1(self): """ Testing for repeated vertices and multiple parts. Test tag: <tc>#tests#Chain.vertices</tc> """ vertices = [Point((0, 0)), Point((1, 1)), Point((2, 5)), Point((0, 0)), Point((1, 1)), Point((2, 5))] self.assertEquals(Chain(vertices).vertices, vertices) vertices = [[Point((0, 0)), Point((1, 1)), Point((2, 5))], [Point((0, 0)), Point((1, 1)), Point((2, 5))]] self.assertEquals(Chain(vertices).vertices, vertices[0] + vertices[1])
def test_len1(self): """ Test correctness with multiple parts and zero-length point-to-point distances. Test tag: <tc>#tests#Chain.len</tc> """ vertices = [[Point((0, 0)), Point((1, 0)), Point((1, 5))], [Point((-5, -5)), Point((-5, 0)), Point((0, 0)), Point((0, 0))]] self.assertEquals(Chain(vertices).len, 6 + 10)
def test_bounding_box1(self): """ Test correctness with multiple parts. Test tag: <tc>#tests#Chain.bounding_box</tc> """ vertices = [[Point((0, 0)), Point((1, 1)), Point((2, 6))], [Point((-5, -5)), Point((0, 0)), Point((2, 5))]] bb = Chain(vertices).bounding_box self.assertEquals(bb.left, -5) self.assertEquals(bb.lower, -5) self.assertEquals(bb.right, 2) self.assertEquals(bb.upper, 6)