Skip to content

Commit

Permalink
Merge pull request #1502 from asmacdo/uri-scheme-rendering-2
Browse files Browse the repository at this point in the history
Fixup URI scheme rendering in --help output
  • Loading branch information
yarikoptic authored Sep 27, 2024
2 parents af2bae5 + ea2fa93 commit 4373cc5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
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

0 comments on commit 4373cc5

Please sign in to comment.