Skip to content

Commit

Permalink
new test correction
Browse files Browse the repository at this point in the history
  • Loading branch information
GinzburgLev committed Jan 27, 2025
1 parent 8765fa2 commit d50bdce
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions tests/dataconverter/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,24 +105,21 @@ def test_valid_data_dict(caplog, data_dict):


@pytest.mark.parametrize(
"data_dict",
"data_dict, error_message",
[
pytest.param(get_data_dict(), id="valid-unaltered-data-dict"),
pytest.param(
remove_from_dict(
"/ENTRY[my_entry]/NXODD_name[nxodd_name]/float_value", get_data_dict()
),
id="removed-optional-value",
"There were attributes set for the field /ENTRY[my_entry]/NXODD_name[nxodd_name]/float_value, but the field does not exist.",
id="removed-optional-value-with-attribute-remaining",
),
],
)
def test_data_dict_attr_with_no_field(caplog, data_dict):
def test_data_dict_attr_with_no_field(caplog, data_dict, error_message):
with caplog.at_level(logging.WARNING):
validate_dict_against("NXtest", data_dict)[0]
assert (
caplog.text
== "There were attributes set for the field /ENTRY[my_entry]/NXODD_name[nxodd_name]/float_value, but the field does not exist."
)
assert not validate_dict_against("NXtest", data_dict)[0]
assert error_message in caplog.text


@pytest.mark.parametrize(
Expand Down

0 comments on commit d50bdce

Please sign in to comment.