# 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


import numpy as np
import pytest
import cartopy.crs as ccrs
from numpy.testing import assert_almost_equal, assert_array_almost_equal
from .helpers import check_proj_params

    def test_eccentric_globe(self):
        globe = ccrs.Globe(semimajor_axis=1000, semiminor_axis=500,
                           ellipse=None)
        aea = ccrs.AlbersEqualArea(globe=globe)
        other_args = {'a=1000', 'b=500', 'lon_0=0.0', 'lat_0=0.0', 'x_0=0.0',
                      'y_0=0.0', 'lat_1=20.0', 'lat_2=50.0'}
        check_proj_params('aea', aea, other_args)

        assert_almost_equal(np.array(aea.x_limits),
                            [-2323.47073363411, 2323.47073363411],
                            decimal=-2)
        assert_almost_equal(np.array(aea.y_limits),
                            [-572.556243423972, 2402.36176984391],
                            decimal=10)

    def test_eastings(self):
        aea_offset = ccrs.AlbersEqualArea(false_easting=1234,
                                          false_northing=-4321)

        other_args = {'ellps=WGS84', 'lon_0=0.0', 'lat_0=0.0', 'x_0=1234',
                      'y_0=-4321', 'lat_1=20.0', 'lat_2=50.0'}
        check_proj_params('aea', aea_offset, other_args)

    @pytest.mark.parametrize('lon', [-10.0, 10.0])
    def test_central_longitude(self, lon):
        aea = ccrs.AlbersEqualArea()
        aea_offset = ccrs.AlbersEqualArea(central_longitude=lon)
        other_args = {'ellps=WGS84', f'lon_0={lon}', 'lat_0=0.0',
                      'x_0=0.0', 'y_0=0.0', 'lat_1=20.0', 'lat_2=50.0'}

# 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_albers_equal_area.py
import numpy as np
import pytest
import cartopy.crs as ccrs
from numpy.testing import assert_almost_equal, assert_array_almost_equal
from .helpers import check_proj_params


    def test_eccentric_globe(self):
        globe = ccrs.Globe(semimajor_axis=1000, semiminor_axis=500,
                           ellipse=None)
        aea = ccrs.AlbersEqualArea(globe=globe)
        other_args = {'a=1000', 'b=500', 'lon_0=0.0', 'lat_0=0.0', 'x_0=0.0',
                      'y_0=0.0', 'lat_1=20.0', 'lat_2=50.0'}
        check_proj_params('aea', aea, other_args)

        assert_almost_equal(np.array(aea.x_limits),
                            [-2323.47073363411, 2323.47073363411],
                            decimal=-2)
        assert_almost_equal(np.array(aea.y_limits),
                            [-572.556243423972, 2402.36176984391],
                            decimal=10)

    def test_eastings(self):
        aea_offset = ccrs.AlbersEqualArea(false_easting=1234,
                                          false_northing=-4321)

        other_args = {'ellps=WGS84', 'lon_0=0.0', 'lat_0=0.0', 'x_0=1234',
                      'y_0=-4321', 'lat_1=20.0', 'lat_2=50.0'}
        check_proj_params('aea', aea_offset, other_args)

    @pytest.mark.parametrize('lon', [-10.0, 10.0])
    def test_central_longitude(self, lon):
        aea = ccrs.AlbersEqualArea()
        aea_offset = ccrs.AlbersEqualArea(central_longitude=lon)
        other_args = {'ellps=WGS84', f'lon_0={lon}', 'lat_0=0.0',
                      'x_0=0.0', 'y_0=0.0', 'lat_1=20.0', 'lat_2=50.0'}

        check_proj_params('aea', aea_offset, other_args)