Skip to content

Commit

Permalink
Remove reliance on real data from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DPeterK committed Jun 15, 2016
1 parent c2abe40 commit fdb0f16
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions lib/iris/tests/unit/analysis/maths/test_exponentiate.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import iris.tests as tests
from iris.tests.stock import simple_2d

from biggus import NumpyArrayAdapter
import iris
from iris.analysis.maths import exponentiate
import numpy as np
Expand All @@ -48,41 +49,41 @@ def test_masked(self):
result = exponentiate(cube, self.exponent)
self.assertMaskedArrayEqual(result.data, expected)

@tests.skip_data
def test_lazy_data__inplace(self):
# Confirm that the cube's lazy data is preserved through an operation
# that is not in-place.
test_data = tests.get_data_path(('PP', 'simple_pp', 'global.pp'))
cube = iris.load_cube(test_data)
cube = self.cube.copy()
cube.lazy_data(array=NumpyArrayAdapter(cube.data))
expected = cube.copy().data ** self.exponent
exponentiate(cube, self.exponent, in_place=True)
self.assertTrue(cube.has_lazy_data())
self.assertArrayAlmostEqual(cube.data, expected)

@tests.skip_data
def test_lazy_data__not_inplace(self):
# Confirm that the cube's lazy data is preserved through an
# in-place operation.
test_data = tests.get_data_path(('PP', 'simple_pp', 'global.pp'))
cube = iris.load_cube(test_data)
cube = self.cube.copy()
cube.lazy_data(array=NumpyArrayAdapter(cube.data))
expected = cube.copy().data ** self.exponent
result = exponentiate(cube, self.exponent, in_place=False)
self.assertTrue(result.has_lazy_data())
self.assertArrayEqual(result.data, expected)

@tests.skip_data
def test_exponentiate__preloaded_data__inplace(self):
test_data = tests.get_data_path(('PP', 'simple_pp', 'global.pp'))
cube = iris.load_cube(test_data)
# Confirm that the cube's data is lazy after an in-place operation and
# after pre-loading the data.
cube = self.cube.copy()
cube.lazy_data(array=NumpyArrayAdapter(cube.data))
expected = cube.data ** self.exponent
exponentiate(cube, self.exponent, in_place=True)
self.assertTrue(cube.has_lazy_data())
self.assertArrayAlmostEqual(cube.data, expected)

@tests.skip_data
def test_exponentiate__preloaded_data__not_inplace(self):
test_data = tests.get_data_path(('PP', 'simple_pp', 'global.pp'))
cube = iris.load_cube(test_data)
# Confirm that the cube's data is lazy after an operation that is not
# in-place and after pre-loading the data.
cube = self.cube.copy()
cube.lazy_data(array=NumpyArrayAdapter(cube.data))
expected = cube.data ** self.exponent
result = exponentiate(cube, self.exponent, in_place=False)
self.assertTrue(result.has_lazy_data())
Expand Down

0 comments on commit fdb0f16

Please sign in to comment.