示例#1
0
def test_same_line_is_parallel():
    line = Line(Point(0, 0), 1)
    l2 = Line(Point(1, 100), 0)
    l3 = Line(Point(2, -23), math.inf)
    assert line.is_parallel_to(line)
    assert l2.is_parallel_to(l2)
    assert l3.is_parallel_to(l3)
示例#2
0
def test_parallel_lines_are_parallel():
    line = Line(Point(0, 0), 1)
    l2 = Line(Point(1, 100), 1)
    assert line.is_parallel_to(l2)

    line.slope = math.inf
    l2.slope = math.inf
    assert line.is_parallel_to(l2)

    line.slope = 0
    l2.slope = 0
    assert line.is_parallel_to(l2)