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

Fixup URI scheme rendering in --help output #1502

Merged
merged 3 commits into from
Sep 27, 2024
Merged
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
2 changes: 1 addition & 1 deletion dandi/dandiarchive.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ class _dandi_url_parser:
for a DANDI Archive instance. If an optional ``version`` field is
omitted from a URL, the given Dandiset's most recent published version
will be used if it has one, and its draft version will be used otherwise.
"""
"""
known_patterns = "Accepted resource identifier patterns:" + "\n - ".join(
[""] + [display for _, _, display in known_urls]
)
Expand Down
22 changes: 22 additions & 0 deletions dandi/tests/test_helptext.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import subprocess


def get_helptext(command):
result = subprocess.run(
[*command, '--help'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True
)
return result.stdout


def test_resource_identifier_helptext():
# The \n chars must be included for correct rendering
correct = "Accepted resource identifier patterns:\n - DANDI:<dandiset id>[/<version>]\n"

ls_helptext = get_helptext(['dandi', 'ls'])
assert correct in ls_helptext

download_helptext = get_helptext(['dandi', 'download'])
assert correct in download_helptext
Loading