Skip to content

Commit f889612

Browse files
committed
fix warning issue in test
1 parent 68008b5 commit f889612

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tests/test_parameter_error_location.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ def test_param_format_error_warning_includes_file_and_line(self, file_utils):
9292
"""
9393
deck_file = file_utils.get_asset_file_path("parameter_error_location/test_param_format_error.k")
9494
deck = Deck()
95-
result = deck.import_file(deck_file)
95+
with pytest.warns(UserWarning, match=r"Error processing parameter"):
96+
result = deck.import_file(deck_file)
9697
assert len(result.warnings) >= 1
9798
warning = result.warnings[0]
9899
assert "Error processing parameter" in warning
@@ -107,7 +108,8 @@ def test_param_format_error_loads_no_file_path(self, file_utils):
107108
"""
108109
deck_content = (file_utils.assets_folder / "parameter_error_location" / "test_param_format_error.k").read_text()
109110
deck = Deck()
110-
result = deck.loads(deck_content)
111+
with pytest.warns(UserWarning, match=r"Error processing parameter"):
112+
result = deck.loads(deck_content)
111113
assert len(result.warnings) >= 1
112114
warning = result.warnings[0]
113115
assert "Error processing parameter" in warning
@@ -129,7 +131,8 @@ def test_param_format_error_line_number_with_comments(self):
129131
1 &x_coord 0.0 0.0
130132
*END"""
131133
deck = Deck()
132-
result = deck.loads(deck_content)
134+
with pytest.warns(UserWarning, match=r"Error processing parameter"):
135+
result = deck.loads(deck_content)
133136
assert len(result.warnings) >= 1
134137
warning = result.warnings[0]
135138
assert "Error processing parameter" in warning

0 commit comments

Comments
 (0)