# Path: lib/eofs/tests/reference.py
# def reference_solution(container_type, weights):
#     """Obtain a reference EOF analysis solution.
# 
#     **Arguments:**
# 
#     *container_type*
#         Either 'standard', 'cdms', 'iris' or 'xarray'.
# 
#     *weights*
#         Weights method. One of 'equal', 'latitude', or 'area'.
# 
#     """
#     container_type = container_type.lower()
#     weights = weights.lower()
#     if container_type not in ('standard', 'iris', 'cdms', 'xarray'):
#         raise ValueError("unknown container type "
#                          "'{!s}'".format(container_type))
#     solution = _read_reference_solution(weights)
#     time_units = 'months since 0-1-1 00:00:0.0'
#     neofs = len(solution['eigenvalues'])
#     _get_wrapper(container_type)(solution, neofs, time_units)
#     return solution


import numpy as np
    import cdms2
import pytest
import eofs
from eofs.tests import EofsTest
from .reference import reference_solution

class TestErrorHandlersCDMS(ErrorHandlersTest):
    """Test error handling in the cdms interface."""
    interface = 'cdms'
    weights = 'equal'

    def test_projectField_invalid_type(self):
        # projecting a field of the wrong type
        solution = reference_solution('standard', 'equal')
        with pytest.raises(TypeError):
            pcs = self.solver.projectField(solution['sst'])


# ----------------------------------------------------------------------------
# Error Handler tests for the iris interface


class TestErrorHandlersIris(ErrorHandlersTest):
    """Test error handling in the iris interface."""
    interface = 'iris'
    weights = 'equal'

    def test_projectField_invalid_type(self):
        # projecting a field of the wrong type
        solution = reference_solution('standard', 'equal')
        with pytest.raises(TypeError):
            pcs = self.solver.projectField(solution['sst'])

    def test_projectField_different_missing_values(self):
        # projecting a field with different missing values

# Path: lib/eofs/tests/reference.py
# def reference_solution(container_type, weights):
#     """Obtain a reference EOF analysis solution.
# 
#     **Arguments:**
# 
#     *container_type*
#         Either 'standard', 'cdms', 'iris' or 'xarray'.
# 
#     *weights*
#         Weights method. One of 'equal', 'latitude', or 'area'.
# 
#     """
#     container_type = container_type.lower()
#     weights = weights.lower()
#     if container_type not in ('standard', 'iris', 'cdms', 'xarray'):
#         raise ValueError("unknown container type "
#                          "'{!s}'".format(container_type))
#     solution = _read_reference_solution(weights)
#     time_units = 'months since 0-1-1 00:00:0.0'
#     neofs = len(solution['eigenvalues'])
#     _get_wrapper(container_type)(solution, neofs, time_units)
#     return solution


# Path: lib/eofs/tests/test_error_handling.py
import numpy as np
    import cdms2
import pytest
import eofs
from eofs.tests import EofsTest
from .reference import reference_solution


class TestErrorHandlersCDMS(ErrorHandlersTest):
    """Test error handling in the cdms interface."""
    interface = 'cdms'
    weights = 'equal'

    def test_projectField_invalid_type(self):
        # projecting a field of the wrong type
        solution = reference_solution('standard', 'equal')
        with pytest.raises(TypeError):
            pcs = self.solver.projectField(solution['sst'])


# ----------------------------------------------------------------------------
# Error Handler tests for the iris interface


class TestErrorHandlersIris(ErrorHandlersTest):
    """Test error handling in the iris interface."""
    interface = 'iris'
    weights = 'equal'

    def test_projectField_invalid_type(self):
        # projecting a field of the wrong type
        solution = reference_solution('standard', 'equal')
        with pytest.raises(TypeError):
            pcs = self.solver.projectField(solution['sst'])

    def test_projectField_different_missing_values(self):
        # projecting a field with different missing values

        solution = reference_solution(self.interface, self.weights)