Skip to content

Commit e23f2d8

Browse files
committed
small changes made to naming and tests
1 parent 8e0501b commit e23f2d8

File tree

1 file changed

+11
-24
lines changed

1 file changed

+11
-24
lines changed

lib/iris/tests/unit/cube/test_Cube.py

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ def test_kwargs(self):
409409
self.assertMaskedArrayEqual(expected_result, res_cube.data)
410410

411411

412-
class TestSlices(tests.IrisTest):
412+
class Test_slices_dim_order(tests.IrisTest):
413413
'''
414414
This class tests the capability of iris.cube.Cube.slices(), including its
415415
ability to correctly re-order the dimensions.
@@ -451,7 +451,7 @@ def expected_cube_setup(dim1name, dim2name, dim3name):
451451
cube.add_dim_coord(iris.coords.DimCoord([0], dim3name), [2])
452452
return cube
453453

454-
def make_the_test(self, dim1, dim2, dim3, dim_to_remove):
454+
def check_order(self, dim1, dim2, dim3, dim_to_remove):
455455
'''
456456
does two things:
457457
(1) slices the 4D cube in dim1, dim2, dim3 (and removes the scalar
@@ -478,7 +478,8 @@ def make_the_test(self, dim1, dim2, dim3, dim_to_remove):
478478
sliced_cube = next(self.cube.slices([dim1, dim2, dim3]))
479479
sliced_cube.remove_coord(dim_to_remove)
480480
expected_cube = self.expected_cube_setup(dim1, dim2, dim3)
481-
return sliced_cube, expected_cube
481+
return self.assertEqual(sliced_cube, expected_cube)
482+
482483

483484
def test_height_long_lat(self):
484485
'''
@@ -487,9 +488,7 @@ def test_height_long_lat(self):
487488
longitude
488489
latitude
489490
'''
490-
actual, expected = self.make_the_test(
491-
"height", "longitude", "latitude", "time")
492-
self.assertEqual(actual, expected)
491+
self.check_order("height", "longitude", "latitude", "time")
493492

494493
def test_long_height_lat(self):
495494
'''
@@ -498,9 +497,7 @@ def test_long_height_lat(self):
498497
height
499498
latitude
500499
'''
501-
actual, expected = self.make_the_test(
502-
"longitude", "height", "latitude", "time")
503-
self.assertEqual(actual, expected)
500+
self.check_order("longitude", "height", "latitude", "time")
504501

505502
def test_time_height_lat(self):
506503
'''
@@ -509,9 +506,7 @@ def test_time_height_lat(self):
509506
height
510507
latitude
511508
'''
512-
actual, expected = self.make_the_test(
513-
"time", "height", "latitude", "longitude")
514-
self.assertEqual(actual, expected)
509+
self.check_order("time", "height", "latitude", "longitude")
515510

516511
def test_time_height_long(self):
517512
'''
@@ -520,9 +515,7 @@ def test_time_height_long(self):
520515
height
521516
longitude
522517
'''
523-
actual, expected = self.make_the_test(
524-
"time", "height", "longitude", "latitude")
525-
self.assertEqual(actual, expected)
518+
self.check_order("time", "height", "longitude", "latitude")
526519

527520
def test_long_lat_height(self):
528521
'''
@@ -531,9 +524,7 @@ def test_long_lat_height(self):
531524
latitude
532525
height
533526
'''
534-
actual, expected = self.make_the_test(
535-
"longitude", "latitude", "height", "time")
536-
self.assertEqual(actual, expected)
527+
self.check_order("longitude", "latitude", "height", "time")
537528

538529
def test_lat_height_time(self):
539530
'''
@@ -542,9 +533,7 @@ def test_lat_height_time(self):
542533
height
543534
time
544535
'''
545-
actual, expected = self.make_the_test(
546-
"latitude", "height", "time", "longitude")
547-
self.assertEqual(actual, expected)
536+
self.check_order("latitude", "height", "time", "longitude")
548537

549538
def test_long_height_time(self):
550539
'''
@@ -553,9 +542,7 @@ def test_long_height_time(self):
553542
height
554543
time
555544
'''
556-
actual, expected = self.make_the_test(
557-
"longitude", "height", "time", "latitude")
558-
self.assertEqual(actual, expected)
545+
self.check_order("longitude", "height", "time", "latitude")
559546

560547

561548
@tests.skip_data

0 commit comments

Comments
 (0)