Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#345: correct error message #346

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions py_mmd_tools/nc_to_mmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,13 +765,14 @@ def get_personnel(self, mmd_element, ncin):
roles_search_result = self.contact_roles.search_lowercase(role)
contact_role = roles_search_result.get("Short_Name", "")

roles_url = ("https://htmlpreview.github.io/?https://github.com/"
"metno/mmd/blob/master/doc/mmd-specification.html"
"#contact-roles")
if contact_role == "":
self.missing_attributes["errors"].append(
"The ACDD attribute 'contact_roles' must "
"The ACDD attribute 'contributor_role' must "
"follow a controlled vocabulary from MMD (see "
"https://htmlpreview.github.io/?https://github."
"com/metno/mmd/blob/master/doc/mmd-specification."
"html##contact_roles)."
f"{roles_url})."
)
return data

Expand Down
2 changes: 1 addition & 1 deletion tests/test_nc_to_mmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -1626,7 +1626,7 @@ def test_get_personnel_role_invalid(self):
# iso_topic_category is not valid
ncin.creator_role = "abcd"
md.get_personnel(mmd_element, ncin)
assert "The ACDD attribute 'contact_roles' must" in md.missing_attributes['errors'][0]
assert "The ACDD attribute 'contributor_role' must" in md.missing_attributes['errors'][0]

def test_personnel(self):
"""Test reading of personnel from nc file into MMD"""
Expand Down
Loading