Skip to content

Commit 5734c89

Browse files
Bugfixing tests & chekc
1 parent 8b6aab9 commit 5734c89

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

src/extensions/score_metamodel/checks/check_options.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ def remove_prefix(word: str, prefixes: list[str]) -> str:
7878

7979
# The filter ensures that the function is only called when needed.
8080
for value in values:
81-
value = remove_prefix(value, allowed_prefixes)
81+
if allowed_prefixes:
82+
value = remove_prefix(value, allowed_prefixes)
8283
try:
8384
if not re.match(pattern, value):
8485
log.warning_for_option(

src/extensions/score_metamodel/tests/test_check_options.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ def test_missing_mandatory_options_info(self):
141141
app = Mock(spec=Sphinx)
142142
app.config = Mock()
143143
app.config.needs_types = self.NEED_TYPE_INFO_WITHOUT_MANDATORY_OPTIONS
144+
app.config.allowed_external_prefixes = []
144145
# Expect that the checks pass
145146
check_options(app, need_1, logger)
146147
logger.assert_warning(
@@ -165,6 +166,7 @@ def test_invalid_option_type(self):
165166
app = Mock(spec=Sphinx)
166167
app.config = Mock()
167168
app.config.needs_types = self.NEED_TYPE_INFO_WITH_INVALID_OPTION_TYPE
169+
app.config.allowed_external_prefixes = []
168170
# Expect that the checks pass
169171
check_options(app, need_1, logger)
170172
logger.assert_warning(
@@ -190,6 +192,7 @@ def test_unknown_option_present_in_neither_req_opt_neither_opt_opt(self):
190192
app = Mock(spec=Sphinx)
191193
app.config = Mock()
192194
app.config.needs_types = self.NEED_TYPE_INFO_WITH_OPT_OPT
195+
app.config.allowed_external_prefixes = []
193196
# Expect that the checks pass
194197
check_extra_options(app, need_1, logger)
195198

0 commit comments

Comments
 (0)