# Path: lib/cartopy/tests/crs/helpers.py
# def check_proj_params(name, crs, other_args):
#     expected = other_args | {f'proj={name}', 'no_defs'}
#     proj_params = set(crs.proj4_init.lstrip('+').split(' +'))
#     assert expected == proj_params


from numpy.testing import assert_almost_equal
from .helpers import check_proj_params
import cartopy.crs as ccrs
# This file is part of Cartopy and is released under the LGPL license.
# See COPYING and COPYING.LESSER in the root of the repository for full
# licensing details.
"""
Tests for the NearsidePerspective projection.

"""




def test_default():
    geos = ccrs.NearsidePerspective()
    other_args = {'a=6378137.0', 'h=35785831', 'lat_0=0.0', 'lon_0=0.0',
                  'units=m', 'x_0=0', 'y_0=0'}

    check_proj_params('nsper', geos, other_args)

    assert_almost_equal(geos.boundary.bounds,
                        (-5476336.098, -5476336.098,
                         5476336.098, 5476336.098),
                        decimal=3)


def test_offset():
    geos = ccrs.NearsidePerspective(false_easting=5000000,
                                    false_northing=-123000,)
    other_args = {'a=6378137.0', 'h=35785831', 'lat_0=0.0', 'lon_0=0.0',
                  'units=m', 'x_0=5000000', 'y_0=-123000'}


# Path: lib/cartopy/tests/crs/helpers.py
# def check_proj_params(name, crs, other_args):
#     expected = other_args | {f'proj={name}', 'no_defs'}
#     proj_params = set(crs.proj4_init.lstrip('+').split(' +'))
#     assert expected == proj_params


# Path: lib/cartopy/tests/crs/test_nearside_perspective.py
from numpy.testing import assert_almost_equal
from .helpers import check_proj_params
import cartopy.crs as ccrs

# This file is part of Cartopy and is released under the LGPL license.
# See COPYING and COPYING.LESSER in the root of the repository for full
# licensing details.
"""
Tests for the NearsidePerspective projection.

"""




def test_default():
    geos = ccrs.NearsidePerspective()
    other_args = {'a=6378137.0', 'h=35785831', 'lat_0=0.0', 'lon_0=0.0',
                  'units=m', 'x_0=0', 'y_0=0'}

    check_proj_params('nsper', geos, other_args)

    assert_almost_equal(geos.boundary.bounds,
                        (-5476336.098, -5476336.098,
                         5476336.098, 5476336.098),
                        decimal=3)


def test_offset():
    geos = ccrs.NearsidePerspective(false_easting=5000000,
                                    false_northing=-123000,)
    other_args = {'a=6378137.0', 'h=35785831', 'lat_0=0.0', 'lon_0=0.0',
                  'units=m', 'x_0=5000000', 'y_0=-123000'}


    check_proj_params('nsper', geos, other_args)