-
-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix #1052: template tag inside template tag
- Loading branch information
1 parent
ad25ce5
commit f2a0a78
Showing
2 changed files
with
34 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
"""Test template tag extended usage. | ||
uv run pytest tests/test_django/test_templatetag_ext.py | ||
""" | ||
|
||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING | ||
|
||
import pytest | ||
|
||
from djlint.reformat import formatter | ||
from tests.conftest import config_builder, printer | ||
|
||
if TYPE_CHECKING: | ||
from typing import Any | ||
|
||
test_data = [ | ||
pytest.param( | ||
('{% component "img" src="{% url \'my_image\' %}" %}'), | ||
('{% component "img" src="{% url \'my_image\' %}" %}\n'), | ||
({"custom_blocks": "component"}), | ||
id="template_tag_inside_template_tag", | ||
) | ||
] | ||
|
||
|
||
@pytest.mark.parametrize(("source", "expected", "args"), test_data) | ||
def test_base(source: str, expected: str, args: dict[str, Any]) -> None: | ||
output = formatter(config_builder(args), source) | ||
|
||
printer(expected, source, output) | ||
assert expected == output |