mirror of
https://github.com/Hopiu/djLint.git
synced 2026-05-22 03:41:51 +00:00
53 lines
1.2 KiB
Python
53 lines
1.2 KiB
Python
"""Djlint tests specific to pyproject.toml configuration.
|
|
|
|
run::
|
|
|
|
pytest tests/test_config.py --cov=src/djlint --cov-branch \
|
|
--cov-report xml:coverage.xml --cov-report term-missing
|
|
|
|
for a single test, run::
|
|
|
|
pytest tests/test_config.py::test_custom_html --cov=src/djlint \
|
|
--cov-branch --cov-report xml:coverage.xml --cov-report term-missing
|
|
|
|
"""
|
|
# pylint: disable=C0116
|
|
|
|
|
|
from click.testing import CliRunner
|
|
|
|
from src.djlint import main as djlint
|
|
|
|
|
|
def test_indent(runner: CliRunner) -> None:
|
|
result = runner.invoke(djlint, ["tests/test_config/test_indent", "--check"])
|
|
print(result.output)
|
|
assert (
|
|
"""-<section><p><div><span></span></div></p></section>
|
|
+<section>
|
|
+ <p>
|
|
+ <div>
|
|
+ <span></span>
|
|
+ </div>
|
|
+ </p>
|
|
+</section>"""
|
|
in result.output
|
|
)
|
|
assert result.exit_code == 1
|
|
|
|
result = runner.invoke(
|
|
djlint, ["tests/test_config/test_indent", "--check", "--indent", 3] # type: ignore
|
|
)
|
|
|
|
assert (
|
|
"""-<section><p><div><span></span></div></p></section>
|
|
+<section>
|
|
+ <p>
|
|
+ <div>
|
|
+ <span></span>
|
|
+ </div>
|
|
+ </p>
|
|
+</section>"""
|
|
in result.output
|
|
)
|
|
assert result.exit_code == 1
|