Exemplo n.º 1
0
def test_raises_if_has_no_lon_attribute():
    bad_location = type('Location', (object, ), dict(lat=0))

    with pytest.raises(AttributeError) as err:
        great_circle_distance(bad_location, (0, 0))

    assert "has no attribute 'lon'" in str(err)
def test_raises_if_has_no_lon_attribute():
    bad_location = type('Location', (object,), dict(lat=0))

    with pytest.raises(AttributeError) as err:
        great_circle_distance(bad_location, (0, 0))

    assert "has no attribute 'lon'" in str(err)
Exemplo n.º 3
0
def test_distance_is_zero_for_the_same_points():
    assert great_circle_distance((0, 0), (0, 0)) == 0
Exemplo n.º 4
0
def test_raises_if_not_a_float():
    with pytest.raises(TypeError):
        great_circle_distance(('0', 0), (0, 0))
Exemplo n.º 5
0
def test_raises_if_has_no_lat_attribute(first):
    with pytest.raises(AttributeError) as err:
        great_circle_distance(first, (0, 0))

    assert "has no attribute 'lat'" in str(err)
Exemplo n.º 6
0
def test_raises_if_unable_to_create_location():
    with pytest.raises(TypeError):
        great_circle_distance((0, ), (0, ))
Exemplo n.º 7
0
def test_known_distances(start, end, low, high):
    assert low < great_circle_distance(start, end) < high
def test_distance_is_zero_for_the_same_points():
    assert great_circle_distance((0, 0), (0, 0)) == 0
def test_raises_if_not_a_float():
    with pytest.raises(TypeError):
        great_circle_distance(('0', 0), (0, 0))
def test_raises_if_has_no_lat_attribute(first):
    with pytest.raises(AttributeError) as err:
        great_circle_distance(first, (0, 0))

    assert "has no attribute 'lat'" in str(err)
def test_raises_if_unable_to_create_location():
    with pytest.raises(TypeError):
        great_circle_distance((0,), (0,))
def test_known_distances(start, end, low, high):
    assert low < great_circle_distance(start, end) < high