Example #1
0
def test_point_distance():
    apoint = Point(50, 50)
    bpoint = Point(50, 50)
    assert apoint == bpoint
    bpoint.x = 10
    assert apoint != bpoint
    apoint = Point(50.197, 50.197)
    data = [
        Point(60.197, 50.197),
        Point(40.197, 50.197),
        Point(50.197, 60.197),
        Point(50.197, 40.197)
    ]
    for pt in data:
        assert apoint._distance_to(pt) == 10, "failed for {}".format(str(pt))
        assert pt._distance_to(apoint) == 10
    assert apoint._distance_to(Point(50, 50)) != 0
Example #2
0
def test_point_distance():
    apoint = Point(50, 50)
    bpoint = Point(50, 50)
    assert apoint == bpoint
    bpoint.x = 10
    assert apoint != bpoint
    apoint = Point(50.197, 50.197)
    data = [
        Point(60.197, 50.197),
        Point(40.197, 50.197),
        Point(50.197, 60.197),
        Point(50.197, 40.197)
    ]
    for pt in data:
        assert apoint._distance_to(pt) == 10, "failed for {}".format(str(pt))
        assert pt._distance_to(apoint) == 10
    assert apoint._distance_to(Point(50, 50)) != 0