def test_check_for_metadata_get_min_max_height():
    height_info = HeightInfo()
    data = height_info.get_min_max_height(51, 7, 52, 8)
    assert data['h_min'] != height_info.NODATA
    assert isinstance(data['h_min'], float)
    assert isinstance(data['location_min'], list)
    assert data['counter_min'] >= 0
    assert data['h_max'] != height_info.NODATA
    assert isinstance(data['h_max'], float)
    assert isinstance(data['location_max'], list)
    assert data['counter_max'] >= 0
    assert isinstance(data['source'], str)
    assert isinstance(data['source_min'], str)
    assert isinstance(data['source_max'], str)
    assert isinstance(data['attributions'], list)
def test_check_bounds_get_min_max_height():
    height_info = HeightInfo()
    # in bounds
    _result = height_info.get_min_max_height(52.5, 5, 53, 5.5)
    assert _result['h_max'] != height_info.NODATA
    assert _result['h_min'] != height_info.NODATA
    # invalid coordinates
    with pytest.raises(ValueError):
        height_info.get_min_max_height(52.5, 5, 91, 5.5)
    with pytest.raises(ValueError):
        height_info.get_min_max_height(-91, 5, 53, 5.5)
    with pytest.raises(ValueError):
        height_info.get_min_max_height(52.5, -181, 53, 5.5)
    with pytest.raises(ValueError):
        height_info.get_min_max_height(52.5, 5, 53, 181)
    # incorrect rectangle
    _result = height_info.get_min_max_height(54.886907, 15.570925, 47.240591,
                                             6.093066)
    assert _result['h_max'] == height_info.NODATA
    assert _result['h_min'] == height_info.NODATA
    # highest and lowest location in the bounding box of Germany
    _result = height_info.get_min_max_height(47.240591, 6.093066, 54.886907,
                                             15.570925)
    assert math.isclose(_result['h_max'], 2920, abs_tol=16)
    assert math.isclose(_result['h_min'], -265.5, abs_tol=16)
    # highest and lowest location of the world
    _result = height_info.get_min_max_height(-90, -180, 90, 180)
    assert math.isclose(_result['h_max'], 8613.2, abs_tol=16)
    assert math.isclose(_result['h_min'], -10952, abs_tol=16)