Skip to content

Commit

Permalink
Implemented review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-vd-aardweg committed Apr 17, 2023
1 parent 0c154f0 commit b2ea2e7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion hydrolib/core/dflowfm/xyn/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def contains_whitespace_while_not_allowed(name: str) -> bool:

if contains_whitespace_while_not_allowed(n):
raise ValueError(
f"Error parsing XYN file '{filepath}', line {linenr+1}. Name `{n}` contains whitespace, so should be enclosed in single quotes."
f"Error parsing XYN file '{filepath}', line {linenr+1}. Name `{n}` contains whitespace, so should be enclosed in quotes."
)

if is_surrounded_by_quotes(n):
Expand Down
8 changes: 4 additions & 4 deletions tests/dflowfm/test_xyn.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_parse_xyn_file(self):

with create_temp_file(file_content, "test.xyn") as xyn_file:
parsed_contents = XYNParser.parse(xyn_file)
assert expected_result == parsed_contents
assert expected_result == parsed_contents

def test_parse_xyn_file_with_single_quoted_name_removes_quotes_and_keeps_whitespace(
self,
Expand All @@ -48,7 +48,7 @@ def test_parse_xyn_file_with_single_quoted_name_removes_quotes_and_keeps_whitesp

with create_temp_file(file_content, "test.xyn") as xyn_file:
parsed_contents = XYNParser.parse(xyn_file)
assert expected_result == parsed_contents
assert expected_result == parsed_contents

def test_parse_xyn_file_with_double_quoted_name_removes_quotes_and_keeps_whitespace(
self,
Expand All @@ -74,7 +74,7 @@ def test_parse_xyn_file_with_too_many_columns_raises_error(self):

with pytest.raises(ValueError) as error:
with create_temp_file(file_content, "test.xyn") as xyn_file:
expected_message = f"Error parsing XYN file '{xyn_file}', line 1. Name `{name}` contains whitespace, so should be enclosed in single quotes."
expected_message = f"Error parsing XYN file '{xyn_file}', line 1. Name `{name}` contains whitespace, so should be enclosed in quotes."
_ = XYNParser.parse(xyn_file)

assert expected_message in str(error.value)
Expand All @@ -99,7 +99,7 @@ def test_serialize_xyn_point(self):

with open(xyn_file) as file:
file_content = file.readlines()
assert file_content == expected_file_content
assert file_content == expected_file_content


class TestXYNModel:
Expand Down

0 comments on commit b2ea2e7

Please sign in to comment.