Exemplo n.º 1
0
def _build_xclim():
    import sys

    objs = {p.__class__.__name__: p.__class__ for p in processes}

    mod = xclim.build_module("finch.processes.xclim",
                             objs,
                             doc="""XCLIM Processes""")
    sys.modules["finch.processes.xclim"] = mod
    return mod
Exemplo n.º 2
0
 def test_nonexistent_process_build_failure(self):
     name = ""
     objs = {"k1": "v1", "k2": "v2"}
     with pytest.raises(AttributeError):
         build_module(name, objs, mode="warn")
Exemplo n.º 3
0
 def test_loud_build_failure(self):
     name = ""
     objs = {"k1": None, "k2": None}
     with pytest.warns(Warning):
         build_module(name, objs, mode="warn")
Exemplo n.º 4
0
 def test_raise_build_failure(self):
     name = ""
     objs = {"k1": None, "k2": None}
     with pytest.raises(NotImplementedError):
         build_module(name, objs, mode="raise")
Exemplo n.º 5
0
 def test_configured_build_failure(self):
     name = ""
     objs = {"k1": None, "k2": None}
     with pytest.raises(AttributeError):
         build_module(name, objs, mode="bananas")
Exemplo n.º 6
0
 def test_quiet_build_failure(self):
     name = None
     objs = {}
     with pytest.raises(TypeError):
         build_module(name, objs, mode="ignore")
Exemplo n.º 7
0
 def test_nonexistent_process_build_failure(self):
     name = ""
     objs = {'k1': 'v1', 'k2': 'v2'}
     with pytest.raises(AttributeError):
         build_module(name, objs, mode='warn')
Exemplo n.º 8
0
 def test_raise_build_failure(self):
     name = ""
     objs = {'k1': None, 'k2': None}
     with pytest.raises(NotImplementedError):
         build_module(name, objs, mode='raise')
Exemplo n.º 9
0
 def test_loud_build_failure(self):
     name = ""
     objs = {'k1': None, 'k2': None}
     with pytest.warns(Warning):
         build_module(name, objs, mode='warn')