# Path: lib/eofs/tests/reference.py
# def reference_multivariate_solution(container_type, weights):
#     """Obtain a reference multivariate EOF analysis solution.
# 
#     **Arguments:**
# 
#     *container_type*
#         Either 'standard', 'cdms', or 'iris'.
# 
#     *weights*
#         Weights method. One of 'equal', 'latitude', 'area',
#         'area_multi', or 'area_multi_mix'.
# 
#     """
#     if weights.lower() == 'area':
#         weights = 'area_multi'
#     if weights.lower() == 'none_area':
#         weights = 'area_multi_mix'
#     solution = reference_solution(container_type, weights)
#     nlon = len(solution['longitude'])
#     slice1 = slice(0, nlon // 2)
#     slice2 = slice(nlon // 2, None)
#     for var in ('longitude',
#                 'sst',
#                 'eofs',
#                 'eofscor',
#                 'eofscov',
#                 'weights',
#                 'rcon',):
#         try:
#             solution[var] = (solution[var][..., slice1],
#                              solution[var][..., slice2])
#         except TypeError:
#             solution[var] = None, None
#     return solution


import numpy as np
    import cdms2
import pytest
import eofs.multivariate as multivariate
from eofs.tests import EofsTest
from .reference import reference_multivariate_solution
                                       weights=[weights1, weights2])


# ----------------------------------------------------------------------------
# Constructor tests for the cdms interface


class TestConstructorCDMS(EofsTest):
    """Test the error handling in the cdms interface constructor."""

    @classmethod
    def setup_class(cls):
        try:
            cls.solver_class = solvers['cdms']
        except KeyError:
            pytest.skip('missing dependencies required to test '
                        'the cdms interface')

    def test_wrong_number_weights(self):
        solution = reference_multivariate_solution('cdms', 'area')
        weights1, weights2 = solution['weights']
        with pytest.raises(ValueError):
            solver = self.solver_class(solution['sst'], weights=[weights1])

    def test_wrong_input_type(self):
        solution = reference_multivariate_solution('standard', 'equal')
        with pytest.raises(TypeError):
            solver = self.solver_class(solution['sst'])

    def test_input_time_dimension_not_first(self):

# Path: lib/eofs/tests/reference.py
# def reference_multivariate_solution(container_type, weights):
#     """Obtain a reference multivariate EOF analysis solution.
# 
#     **Arguments:**
# 
#     *container_type*
#         Either 'standard', 'cdms', or 'iris'.
# 
#     *weights*
#         Weights method. One of 'equal', 'latitude', 'area',
#         'area_multi', or 'area_multi_mix'.
# 
#     """
#     if weights.lower() == 'area':
#         weights = 'area_multi'
#     if weights.lower() == 'none_area':
#         weights = 'area_multi_mix'
#     solution = reference_solution(container_type, weights)
#     nlon = len(solution['longitude'])
#     slice1 = slice(0, nlon // 2)
#     slice2 = slice(nlon // 2, None)
#     for var in ('longitude',
#                 'sst',
#                 'eofs',
#                 'eofscor',
#                 'eofscov',
#                 'weights',
#                 'rcon',):
#         try:
#             solution[var] = (solution[var][..., slice1],
#                              solution[var][..., slice2])
#         except TypeError:
#             solution[var] = None, None
#     return solution


# Path: lib/eofs/tests/test_multivariate_error_handling.py
import numpy as np
    import cdms2
import pytest
import eofs.multivariate as multivariate
from eofs.tests import EofsTest
from .reference import reference_multivariate_solution

                                       weights=[weights1, weights2])


# ----------------------------------------------------------------------------
# Constructor tests for the cdms interface


class TestConstructorCDMS(EofsTest):
    """Test the error handling in the cdms interface constructor."""

    @classmethod
    def setup_class(cls):
        try:
            cls.solver_class = solvers['cdms']
        except KeyError:
            pytest.skip('missing dependencies required to test '
                        'the cdms interface')

    def test_wrong_number_weights(self):
        solution = reference_multivariate_solution('cdms', 'area')
        weights1, weights2 = solution['weights']
        with pytest.raises(ValueError):
            solver = self.solver_class(solution['sst'], weights=[weights1])

    def test_wrong_input_type(self):
        solution = reference_multivariate_solution('standard', 'equal')
        with pytest.raises(TypeError):
            solver = self.solver_class(solution['sst'])

    def test_input_time_dimension_not_first(self):

        solution = reference_multivariate_solution('cdms', 'equal')