Skip to content

Commit

Permalink
per #1534, add unit test for properly adding a trailing semi-colon fo…
Browse files Browse the repository at this point in the history
…r extra field options if not found (currently fails)
  • Loading branch information
georgemccabe committed Mar 23, 2022
1 parent e3c5ee1 commit 65f1188
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions internal_tests/pytests/command_builder/test_command_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -833,3 +833,27 @@ def test_add_met_config_dict_nested(metplus_config):
cbw.add_met_config_dict(dict_name, items)
print(f"env_var_dict: {cbw.env_var_dict}")
assert cbw.env_var_dict.get('METPLUS_OUTER_DICT') == expected_value

@pytest.mark.parametrize(
'extra, expected_value', [
# trailing semi-colon should be added at end automatically
('file_type = NETCDF_NCCF',
"'name=\"name\"; level=\"(*,*)\"; file_type = NETCDF_NCCF;'"),
('file_type = NETCDF_NCCF;',
"'name=\"name\"; level=\"(*,*)\"; file_type = NETCDF_NCCF;'"),
]
)
def test_get_field_info_extra(metplus_config, extra, expected_value):
d_type = 'FCST'
name = 'name'
level = '"(*,*)"'
config = metplus_config()
wrapper = CommandBuilder(config)
actual_value = wrapper.get_field_info(
d_type=d_type,
v_name=name,
v_level=level,
v_extra=extra,
add_curly_braces=False
)[0]
assert actual_value == expected_value

0 comments on commit 65f1188

Please sign in to comment.