Skip to content

Commit 7c4f700

Browse files
committed
Demonstrate new check_graphic in test_plot.
1 parent 5fbcd53 commit 7c4f700

File tree

1 file changed

+5
-24
lines changed

1 file changed

+5
-24
lines changed

lib/iris/tests/test_plot.py

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
import cf_units
1515
import numpy as np
16+
import pytest
1617

1718
import iris
1819
import iris.analysis
@@ -240,14 +241,15 @@ def setUp(self):
240241

241242
@tests.skip_data
242243
@tests.skip_plot
243-
class Test1dScatter(tests.GraphicsTest):
244-
def setUp(self):
245-
super().setUp()
244+
class Test1dScatter:
245+
@pytest.fixture(autouse=True)
246+
def setup(self, check_graphic_caller):
246247
self.cube = iris.load_cube(
247248
tests.get_data_path(("NAME", "NAMEIII_trajectory.txt")),
248249
"Temperature",
249250
)
250251
self.draw_method = iplt.scatter
252+
self.check_graphic = check_graphic_caller
251253

252254
def test_coord_coord(self):
253255
x = self.cube.coord("longitude")
@@ -288,27 +290,6 @@ def test_cube_cube(self):
288290
self.draw_method(x, y, c=c, edgecolor="none")
289291
self.check_graphic()
290292

291-
def test_incompatible_objects(self):
292-
# cubes/coordinates of different sizes cannot be plotted
293-
x = self.cube
294-
y = self.cube.coord("altitude")[:-1]
295-
with self.assertRaises(ValueError):
296-
self.draw_method(x, y)
297-
298-
def test_multidimensional(self):
299-
# multidimensional cubes/coordinates are not allowed
300-
x = _load_4d_testcube()[0, :, :, 0]
301-
y = x.coord("model_level_number")
302-
with self.assertRaises(ValueError):
303-
self.draw_method(x, y)
304-
305-
def test_not_cube_or_coord(self):
306-
# inputs must be cubes or coordinates
307-
x = np.arange(self.cube.shape[0])
308-
y = self.cube
309-
with self.assertRaises(TypeError):
310-
self.draw_method(x, y)
311-
312293

313294
@tests.skip_data
314295
@tests.skip_plot

0 commit comments

Comments
 (0)