Skip to content

Commit 55b1803

Browse files
committed
Switch docstring test to use a RegExp
1 parent 15e2be0 commit 55b1803

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

tests/core_tests/test_plugin_hooks.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Validates all hook registrations in all plugins
33
"""
44
import importlib
5-
import string
5+
import re
66
from numbers import Number
77
from pathlib import Path
88

@@ -16,6 +16,7 @@
1616
database.metadata = MetaData()
1717
Hook.original_init = Hook.__init__
1818

19+
DOC_RE = re.compile(r"^(?:(?:<.+?>|{.+?}|\[.+?\]).+?)*?-\s.+$")
1920
PLUGINS = []
2021

2122

@@ -106,7 +107,7 @@ def test_hook_kwargs(hook):
106107

107108
def test_hook_doc(hook):
108109
if hook.type == "command" and hook.doc:
109-
assert hook.doc[:1] not in "." + string.ascii_letters, \
110+
assert DOC_RE.match(hook.doc), \
110111
"Invalid docstring '{}' format for command hook".format(hook.doc)
111112

112113

0 commit comments

Comments
 (0)