def test_postprocessing_interface():
    """Test the postprocessing module interface."""

    # ensemblestats pre-installed methods
    from pysteps.postprocessing import mean, excprob, banddepth

    # Test ensemblestats
    valid_names_func_pair = [
        ("mean", mean),
        ("excprob", excprob),
        ("banddepth", banddepth),
    ]

    # Test for exisiting functions
    with pytest.warns(RuntimeWarning):
        pysteps.postprocessing.interface.add_postprocessor(
            "excprob",
            "ensemblestat_excprob",
            "ensemblestats",
            [tup[0] for tup in valid_names_func_pair],
        )

    # Test get method for valid and invalid names
    def method_getter(name):
        return pysteps.postprocessing.interface.get_method(name, "ensemblestats")

    invalid_names = [
        "ensemblestat_mean",
        "ensemblestat_excprob",
        "ensemblestat_banddepth",
    ]
    _generic_interface_test(method_getter, valid_names_func_pair, invalid_names)

    # Test diagnostics
    def method_getter(name):
        return pysteps.postprocessing.interface.get_method(name, "diagnostics")

    valid_names_func_pair = []
    invalid_names = ["unknown"]

    _generic_interface_test(method_getter, valid_names_func_pair, invalid_names)

    # Test for invalid argument type
    with pytest.raises(TypeError):
        pysteps.postprocessing.interface.get_method("mean", None)
    with pytest.raises(TypeError):
        pysteps.postprocessing.interface.get_method(None, "ensemblestats")

    # Test for invalid method types
    with pytest.raises(ValueError):
        pysteps.postprocessing.interface.get_method("mean", "forecast")

    # Test print
    pysteps.postprocessing.postprocessors_info()
Test the postprocessing module interface.
pysteps/tests/test_interfaces.py