You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not typically used - normally cubes are obtained by loading data (e.g. :func:iris.load) or from manipulating existing cubes.
Creating small iris cubes instead of DummyCubes would allow us to test previously untested functions, remove mocks, and also avoid situations where the DummyCubes don't match the real iris cube behaviour, e.g:
We currently rely on the
DummyCube
class to imitateiris
cube objects in our unit tests. We've tried to imitate the cube methods that are relevant to the tests, however the realiris
methods can be much more complicated than our implementations in theDummyCube
class, leading to situations where our imitations don't properly match and producing tests that would fail with real cubes.Additionally, a couple of
iris
methods used inprocess_cubes()
are too hard to try and imitate (such asiris.util.reverse
). We've ended up mocking a couple of theprocess_cube()
steps as a result and leaving some functionality untested .It turns out that it's possible to create
iris
cubes from scratch:https://github.com/SciTools/iris/blob/d1125eb613e3c49c4128e004284e572ad337cad1/lib/iris/cube.py#L1098-L1103, though with the caveat:
Creating small
iris
cubes instead ofDummyCube
s would allow us to test previously untested functions, remove mocks, and also avoid situations where theDummyCube
s don't match the realiris
cube behaviour, e.g:One downside is that the
Cube
appears like it's generally meant to be created by loading in data, rather than being created from scratch as above. On the other hand,iris
appears to use the above approach, creating small cubes from scratch, in their unit tests: https://github.com/SciTools/iris/blob/d1125eb613e3c49c4128e004284e572ad337cad1/lib/iris/tests/unit/cube/test_Cube.py#L88-L93The text was updated successfully, but these errors were encountered: