Skip to content

Commit

Permalink
feature 2253 tc_pairs tests
Browse files Browse the repository at this point in the history
  • Loading branch information
John-Sharples committed Oct 2, 2023
1 parent ffb60aa commit 208e8af
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
23 changes: 23 additions & 0 deletions internal/tests/pytests/wrappers/tc_pairs/test_tc_pairs_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,29 @@ def test_get_basin_cyclone_from_bdeck(metplus_config, template, filename,
assert actual_cyclone == expected_cyclone


@pytest.mark.wrapper
def test_get_basin_cyclone_from_bdeck_error(metplus_config):
full_filename = os.path.join('/fake/dir', '20141009bal.dat')
#expected_basin = 'al'
#expected_cyclone = '1009'
time_info = {'date': datetime(2014, 12, 31, 18)}
config = metplus_config

set_minimum_config_settings(config)
wrapper = TCPairsWrapper(config)
wrapper.c_dict['BDECK_DIR'] = '/fake/dir'
wrapper.c_dict['BDECK_TEMPLATE'] = '{date?fmt=%Y}{cyclone?fmt=%s}b{basin?fmt=%s}.dat'
with mock.patch.object(tcp, 'get_tags', return_value = 50 * [0]):
actual = wrapper._get_basin_cyclone_from_bdeck(full_filename,
True,
'al',
'1009',
time_info)
assert actual == (None, None)
last_err = wrapper.logger.error.call_args_list[0][0][0]
assert "Number of regex match groups does not match" in last_err


@pytest.mark.parametrize(
'config_overrides, storm_type, values_to_check, reformat', [
# 0: storm_id
Expand Down
2 changes: 1 addition & 1 deletion metplus/wrappers/tc_pairs_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ class attributes

basin_fmt = f"basin = {basin};"
self.env_var_dict['METPLUS_BASIN'] = basin_fmt

# CYCLONE
cyclone = '[]'
if self.c_dict.get('CYCLONE'):
Expand Down

0 comments on commit 208e8af

Please sign in to comment.