mirror of
https://github.com/Hopiu/djLint.git
synced 2026-04-02 05:30:24 +00:00
39 lines
1 KiB
Python
39 lines
1 KiB
Python
"""Djlint tests specific to django.
|
|
|
|
run::
|
|
|
|
pytest tests/test_django.py --cov=src/djlint --cov-branch \
|
|
--cov-report xml:coverage.xml --cov-report term-missing
|
|
|
|
for a single test, run::
|
|
|
|
pytest tests/test_django.py::test_alpine_js --cov=src/djlint \
|
|
--cov-branch --cov-report xml:coverage.xml --cov-report term-missing
|
|
|
|
"""
|
|
# pylint: disable=C0116
|
|
|
|
from typing import TextIO
|
|
|
|
from click.testing import CliRunner
|
|
|
|
from tests.conftest import reformat
|
|
|
|
|
|
def test_reformat_asset_tag(runner: CliRunner, tmp_file: TextIO) -> None:
|
|
# pylint: disable=C0301
|
|
output = reformat(
|
|
tmp_file,
|
|
runner,
|
|
b"""{% block css %}{% assets "css_error" %}<link type="text/css" rel="stylesheet" href="{{ ASSET_URL }}" />{% endassets %}{% endblock css %}""",
|
|
) # noqa: E501
|
|
assert (
|
|
output.text
|
|
== """{% block css %}
|
|
{% assets "css_error" %}
|
|
<link type="text/css" rel="stylesheet" href="{{ ASSET_URL }}" />
|
|
{% endassets %}
|
|
{% endblock css %}
|
|
"""
|
|
)
|
|
assert output.exit_code == 1
|