Skip to content

Commit 4200cb7

Browse files
committed
Test syntax error within custom block tag
1 parent a3fff57 commit 4200cb7

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

tests/tags/test_custom_simple_block.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,3 +221,30 @@ def test_simple_block_tag_invalid_argument():
221221
╰────
222222
"""
223223
)
224+
225+
226+
def test_simple_block_tag_argument_syntax_error():
227+
template = "{% load repeat from custom_tags %}{% repeat a= %}{% endrepeat %}"
228+
229+
with pytest.raises(TemplateSyntaxError) as exc_info:
230+
engines["django"].from_string(template)
231+
232+
assert (
233+
str(exc_info.value)
234+
== "Could not parse the remainder: '=' from 'a='"
235+
)
236+
237+
with pytest.raises(TemplateSyntaxError) as exc_info:
238+
engines["rusty"].from_string(template)
239+
240+
assert (
241+
str(exc_info.value)
242+
== """\
243+
× Incomplete keyword argument
244+
╭────
245+
1 │ {% load repeat from custom_tags %}{% repeat a= %}{% endrepeat %}
246+
· ─┬
247+
· ╰── here
248+
╰────
249+
"""
250+
)

0 commit comments

Comments
 (0)