From e46c42c58fb18570a813bfe25c996ec37fa9b0a4 Mon Sep 17 00:00:00 2001 From: Austin Macdonald Date: Fri, 27 Sep 2024 12:01:21 -0500 Subject: [PATCH] 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