# 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
# Copyright Cartopy Contributors
#
# 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 Miller coordinate system.

"""




def test_default():
    mill = ccrs.Miller()
    other_args = {'a=6378137.0', 'lon_0=0.0'}
    check_proj_params('mill', mill, other_args)

    assert_almost_equal(np.array(mill.x_limits),
                        [-20037508.3427892, 20037508.3427892])
    assert_almost_equal(np.array(mill.y_limits),
                        [-14691480.7691731, 14691480.7691731])


def test_sphere_globe():
    globe = ccrs.Globe(semimajor_axis=1000, ellipse=None)
    mill = ccrs.Miller(globe=globe)
    other_args = {'a=1000', 'lon_0=0.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_miller.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

# Copyright Cartopy Contributors
#
# 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 Miller coordinate system.

"""




def test_default():
    mill = ccrs.Miller()
    other_args = {'a=6378137.0', 'lon_0=0.0'}
    check_proj_params('mill', mill, other_args)

    assert_almost_equal(np.array(mill.x_limits),
                        [-20037508.3427892, 20037508.3427892])
    assert_almost_equal(np.array(mill.y_limits),
                        [-14691480.7691731, 14691480.7691731])


def test_sphere_globe():
    globe = ccrs.Globe(semimajor_axis=1000, ellipse=None)
    mill = ccrs.Miller(globe=globe)
    other_args = {'a=1000', 'lon_0=0.0'}

    check_proj_params('mill', mill, other_args)