Skip to content

Commit eae1fe4

Browse files
committed
Fix test to expect error on out-of-bounds start/end
1 parent 2549b36 commit eae1fe4

1 file changed

Lines changed: 5 additions & 13 deletions

File tree

mpas_analysis/test/test_mpas_climatology_task.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def test_update_climatology_bounds_and_create_symlinks(self):
138138
mpasClimatologyTask = self.setup_task()
139139
config = mpasClimatologyTask.config
140140

141-
# first make sure the start and end years stay unchanged when we use
141+
# make sure the start and end years stay unchanged when we use
142142
# the start and end years already in the config file
143143
startYear = 2
144144
endYear = 2
@@ -165,18 +165,10 @@ def test_update_climatology_bounds_and_create_symlinks(self):
165165
config.set('climatology', 'startDate', startDate)
166166
config.set('climatology', 'endDate', endDate)
167167

168-
update_time_bounds_from_file_names(config, 'climatology', 'ocean')
169-
mpasClimatologyTask._create_symlinks()
170-
171-
startYear = 2
172-
endYear = 2
173-
startDate = '{:04d}-01-01_00:00:00'.format(startYear)
174-
endDate = '{:04d}-12-31_23:59:59'.format(endYear)
175-
176-
assert(mpasClimatologyTask.startYear == startYear)
177-
assert(mpasClimatologyTask.endYear == endYear)
178-
assert(mpasClimatologyTask.startDate == startDate)
179-
assert(mpasClimatologyTask.endDate == endDate)
168+
with self.assertRaisesRegex(ValueError,
169+
'climatology start and/or end year '
170+
'different from requested'):
171+
update_time_bounds_from_file_names(config, 'climatology', 'ocean')
180172

181173
def test_subtask_run_analysis(self):
182174
mpasClimatologyTask = self.setup_task()

0 commit comments

Comments
 (0)