Exemplo n.º 1
0
    def test_comp_length(self):
        """Check that you can compute the length of the Surface
        """
        line1 = Arc1(begin=1, end=1j, radius=1)
        line1.comp_length = MagicMock(return_value=1)
        line2 = Arc2(begin=1, center=0, angle=pi / 2)
        line2.comp_length = MagicMock(return_value=1)
        line3 = Segment(begin=1j, end=0)
        line3.comp_length = MagicMock(return_value=1)

        surface = SurfLine(line_list=[line1, line2, line3],
                           label="test",
                           point_ref=0)
        length = surface.comp_length()
        line1.comp_length.assert_called_once()
        line2.comp_length.assert_called_once()
        line3.comp_length.assert_called_once()
        self.assertAlmostEqual(abs(length - 3), 0)
Exemplo n.º 2
0
    def test_comp_length(self, test_dict):
        """Check that you the length return by comp_length is correct
        """
        segment = Segment(test_dict["begin"], test_dict["end"])

        self.assertAlmostEqual(segment.comp_length(), test_dict["length"])
Exemplo n.º 3
0
 def test_comp_length_Point_error(self):
     """Check that comp_length can detect a one point segment
     """
     segment = Segment(0, 0)
     with self.assertRaises(PointSegmentError):
         segment.comp_length()