mirror of
https://github.com/django-components/django-components.git
synced 2025-11-19 14:26:46 +00:00
Deployed 49afdb49 to dev with MkDocs 1.6.1 and mike 2.1.3
This commit is contained in:
parent
01f6852b4d
commit
5c55ebeac8
188 changed files with 3598 additions and 863 deletions
29
dev/examples/recursion/test_example_recursive.py
Normal file
29
dev/examples/recursion/test_example_recursive.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import pytest
|
||||
from django.template import Context, Template
|
||||
|
||||
from django_components import registry, types
|
||||
from django_components.testing import djc_test
|
||||
|
||||
|
||||
def _import_components():
|
||||
from docs.examples.recursion.component import Recursion # noqa: PLC0415
|
||||
|
||||
registry.register("recursion", Recursion)
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
@djc_test
|
||||
class TestRecursion:
|
||||
def test_renders_recursively(self):
|
||||
_import_components()
|
||||
|
||||
template_str: types.django_html = """
|
||||
{% load component_tags %}
|
||||
{% component "recursion" / %}
|
||||
"""
|
||||
template = Template(template_str)
|
||||
rendered = template.render(Context({}))
|
||||
|
||||
# Expect 101 levels of depth (0 to 100)
|
||||
assert rendered.count("Recursion depth:") == 100
|
||||
assert "Reached maximum recursion depth!" in rendered
|
||||
Loading…
Add table
Add a link
Reference in a new issue