Example #1
0
def test_haversine_invalid_coordinates():
    with pytest.raises(geoselect.InvalidCoordinate):
        assert geoselect.haversine(100, 0, 0, 0)
    with pytest.raises(geoselect.InvalidCoordinate):
        assert geoselect.haversine(0, 0, 100, 0)
    with pytest.raises(geoselect.InvalidCoordinate):
        assert geoselect.haversine(0, 190, 0, 0)
    with pytest.raises(geoselect.InvalidCoordinate):
        assert geoselect.haversine(0, 0, 0, -190)
Example #2
0
def test_haversine_order_is_irrelevant():
    assert geoselect.haversine(40.764276, -73.975189, 40.7988811, -73.9591938) ==\
        geoselect.haversine(40.7988811, -73.9591938, 40.764276, -73.975189)
Example #3
0
def test_haversine_same_point_zero():
    assert geoselect.haversine(40.764276, -73.975189, 40.764276, -73.975189) == 0