From 50d61df49496235f3053b14a08d9a8eb97976897 Mon Sep 17 00:00:00 2001 From: Austin Macdonald Date: Fri, 27 Sep 2024 11:17:30 -0500 Subject: [PATCH 1/3] Fixup URI scheme rendering --- dandi/dandiarchive.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dandi/dandiarchive.py b/dandi/dandiarchive.py index 40eb5fb3f..eefb99af5 100644 --- a/dandi/dandiarchive.py +++ b/dandi/dandiarchive.py @@ -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] ) From e46c42c58fb18570a813bfe25c996ec37fa9b0a4 Mon Sep 17 00:00:00 2001 From: Austin Macdonald Date: Fri, 27 Sep 2024 12:01:21 -0500 Subject: [PATCH 2/3] Assert newlines in helptext --- dandi/tests/test_helptext.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 dandi/tests/test_helptext.py diff --git a/dandi/tests/test_helptext.py b/dandi/tests/test_helptext.py new file mode 100644 index 000000000..552342fe4 --- /dev/null +++ b/dandi/tests/test_helptext.py @@ -0,0 +1,16 @@ +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:[/]\n" + + ls_helptext = get_helptext(['dandi', 'ls']) + assert correct in ls_helptext + + download_helptext = get_helptext(['dandi', 'download']) + assert correct in download_helptext From ea2fa9311772851f82e7a0cd059cf8b62393366c Mon Sep 17 00:00:00 2001 From: Austin Macdonald Date: Fri, 27 Sep 2024 12:06:51 -0500 Subject: [PATCH 3/3] Fixup lint --- dandi/tests/test_helptext.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dandi/tests/test_helptext.py b/dandi/tests/test_helptext.py index 552342fe4..b72062112 100644 --- a/dandi/tests/test_helptext.py +++ b/dandi/tests/test_helptext.py @@ -2,9 +2,15 @@ def get_helptext(command): - result = subprocess.run([*command, '--help'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) + 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:[/]\n"