Skip to content

Commit

Permalink
Revert "Use 3-arg click callback for validate_orcid_id"
Browse files Browse the repository at this point in the history
This reverts commit 9f01a87.
  • Loading branch information
svenvanderburg committed Aug 9, 2021
1 parent 9f01a87 commit 859c68b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions nanopub/setup_nanopub_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@
ORCID_ID_REGEX = r'^https://orcid.org/(\d{4}-){3}\d{3}(\d|X)$'


def validate_orcid_id(ctx, param, orcid_id: str):
def validate_orcid_id(ctx, orcid_id: str):
"""
Check if valid ORCID iD, should be https://orcid.org/ + 16 digit in form:
https://orcid.org/0000-0000-0000-0000. ctx and param are
necessary `click` callback arguments
https://orcid.org/0000-0000-0000-0000
"""
if re.match(ORCID_ID_REGEX, orcid_id):
return orcid_id
Expand Down
4 changes: 2 additions & 2 deletions tests/test_setup_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def test_validate_orcid_id():
valid_ids = ['https://orcid.org/1234-5678-1234-5678',
'https://orcid.org/1234-5678-1234-567X']
for orcid_id in valid_ids:
assert validate_orcid_id(ctx=None, param=None, orcid_id=orcid_id) == orcid_id
assert validate_orcid_id(ctx=None, orcid_id=orcid_id) == orcid_id

invalid_ids = ['https://orcid.org/abcd-efgh-abcd-efgh',
'https://orcid.org/1234-5678-1234-567',
Expand All @@ -112,4 +112,4 @@ def test_validate_orcid_id():
'0000-0000-0000-0000']
for orcid_id in invalid_ids:
with pytest.raises(ValueError):
validate_orcid_id(ctx=None, param=None, orcid_id=orcid_id)
validate_orcid_id(ctx=None, orcid_id=orcid_id)

0 comments on commit 859c68b

Please sign in to comment.