Пример #1
0
def test_angle(angle: float):
    epsilon = 0.0001
    x = math.cos(math.radians(angle))
    y = math.sin(math.radians(angle))
    ls = LineSegment(Point(0, 0), Point(x, y))
    assert abs(ls.angle() - angle) < epsilon
Пример #2
0
def test_line_segment_angle_180():
    line_segment = LineSegment(Point(0, 0), Point(-1, 0))
    assert line_segment.angle() == 180
Пример #3
0
def test_line_segment_angle_boundaries(x1, y1, x2, y2):
    line_segment = LineSegment(Point(x1, y1), Point(x2, y2))
    assert 0 <= line_segment.angle() < 360
Пример #4
0
def test_line_segment_angle_zero():
    line_segment = LineSegment(Point(0, 0), Point(1, 0))
    assert line_segment.angle() == 0