コード例 #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)
コード例 #2
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)
コード例 #3
0
def test_distance_is_zero_for_the_same_points():
    assert great_circle_distance((0, 0), (0, 0)) == 0
コード例 #4
0
def test_raises_if_not_a_float():
    with pytest.raises(TypeError):
        great_circle_distance(('0', 0), (0, 0))
コード例 #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)
コード例 #6
0
def test_raises_if_unable_to_create_location():
    with pytest.raises(TypeError):
        great_circle_distance((0, ), (0, ))
コード例 #7
0
def test_known_distances(start, end, low, high):
    assert low < great_circle_distance(start, end) < high
コード例 #8
0
def test_distance_is_zero_for_the_same_points():
    assert great_circle_distance((0, 0), (0, 0)) == 0
コード例 #9
0
def test_raises_if_not_a_float():
    with pytest.raises(TypeError):
        great_circle_distance(('0', 0), (0, 0))
コード例 #10
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)
コード例 #11
0
def test_raises_if_unable_to_create_location():
    with pytest.raises(TypeError):
        great_circle_distance((0,), (0,))
コード例 #12
0
def test_known_distances(start, end, low, high):
    assert low < great_circle_distance(start, end) < high