# 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
from .helpers import check_proj_params
                        [-1, 1])

    lats = np.arange(0, 91, 5)[::-1]
    lons = np.full_like(lats, 90)
    result = moll.transform_points(geodetic, lons, lats)

    expected_x = np.array([
        0.00000, 0.20684, 0.32593, 0.42316, 0.50706, 0.58111, 0.64712, 0.70617,
        0.75894, 0.80591, 0.84739, 0.88362, 0.91477, 0.94096, 0.96229, 0.97882,
        0.99060, 0.99765, 1.00000,
    ])
    assert_almost_equal(result[:, 0], expected_x, decimal=5)

    expected_y = np.array([
        1.00000, 0.97837, 0.94539, 0.90606, 0.86191, 0.81382, 0.76239, 0.70804,
        0.65116, 0.59204, 0.53097, 0.46820, 0.40397, 0.33850, 0.27201, 0.20472,
        0.13681, 0.06851, 0.00000,
    ])
    assert_almost_equal(result[:, 1], expected_y, decimal=5)


def test_sphere_transform():
    # USGS Professional Paper 1395, pg 367
    globe = ccrs.Globe(semimajor_axis=1.0, semiminor_axis=1.0,
                       ellipse=None)
    moll = ccrs.Mollweide(central_longitude=-90.0,
                          globe=globe)
    geodetic = moll.as_geodetic()

    other_args = {'a=1.0', 'b=1.0', 'lon_0=-90.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_mollweide.py
import numpy as np
import pytest
import cartopy.crs as ccrs
from numpy.testing import assert_almost_equal
from .helpers import check_proj_params

                        [-1, 1])

    lats = np.arange(0, 91, 5)[::-1]
    lons = np.full_like(lats, 90)
    result = moll.transform_points(geodetic, lons, lats)

    expected_x = np.array([
        0.00000, 0.20684, 0.32593, 0.42316, 0.50706, 0.58111, 0.64712, 0.70617,
        0.75894, 0.80591, 0.84739, 0.88362, 0.91477, 0.94096, 0.96229, 0.97882,
        0.99060, 0.99765, 1.00000,
    ])
    assert_almost_equal(result[:, 0], expected_x, decimal=5)

    expected_y = np.array([
        1.00000, 0.97837, 0.94539, 0.90606, 0.86191, 0.81382, 0.76239, 0.70804,
        0.65116, 0.59204, 0.53097, 0.46820, 0.40397, 0.33850, 0.27201, 0.20472,
        0.13681, 0.06851, 0.00000,
    ])
    assert_almost_equal(result[:, 1], expected_y, decimal=5)


def test_sphere_transform():
    # USGS Professional Paper 1395, pg 367
    globe = ccrs.Globe(semimajor_axis=1.0, semiminor_axis=1.0,
                       ellipse=None)
    moll = ccrs.Mollweide(central_longitude=-90.0,
                          globe=globe)
    geodetic = moll.as_geodetic()

    other_args = {'a=1.0', 'b=1.0', 'lon_0=-90.0'}

    check_proj_params('moll', moll, other_args)