mirror of
https://github.com/django-components/django-components.git
synced 2025-09-28 08:24:46 +00:00
refactor: replace isort, black and flake8 with ruff (#1346)
Some checks are pending
Docs - build & deploy / docs (push) Waiting to run
Run tests / build (ubuntu-latest, 3.10) (push) Waiting to run
Run tests / build (ubuntu-latest, 3.11) (push) Waiting to run
Run tests / build (ubuntu-latest, 3.12) (push) Waiting to run
Run tests / build (ubuntu-latest, 3.13) (push) Waiting to run
Run tests / build (ubuntu-latest, 3.8) (push) Waiting to run
Run tests / test_sampleproject (3.13) (push) Waiting to run
Run tests / build (ubuntu-latest, 3.9) (push) Waiting to run
Run tests / build (windows-latest, 3.10) (push) Waiting to run
Run tests / build (windows-latest, 3.11) (push) Waiting to run
Run tests / build (windows-latest, 3.12) (push) Waiting to run
Run tests / build (windows-latest, 3.13) (push) Waiting to run
Run tests / build (windows-latest, 3.8) (push) Waiting to run
Run tests / build (windows-latest, 3.9) (push) Waiting to run
Run tests / test_docs (3.13) (push) Waiting to run
Some checks are pending
Docs - build & deploy / docs (push) Waiting to run
Run tests / build (ubuntu-latest, 3.10) (push) Waiting to run
Run tests / build (ubuntu-latest, 3.11) (push) Waiting to run
Run tests / build (ubuntu-latest, 3.12) (push) Waiting to run
Run tests / build (ubuntu-latest, 3.13) (push) Waiting to run
Run tests / build (ubuntu-latest, 3.8) (push) Waiting to run
Run tests / test_sampleproject (3.13) (push) Waiting to run
Run tests / build (ubuntu-latest, 3.9) (push) Waiting to run
Run tests / build (windows-latest, 3.10) (push) Waiting to run
Run tests / build (windows-latest, 3.11) (push) Waiting to run
Run tests / build (windows-latest, 3.12) (push) Waiting to run
Run tests / build (windows-latest, 3.13) (push) Waiting to run
Run tests / build (windows-latest, 3.8) (push) Waiting to run
Run tests / build (windows-latest, 3.9) (push) Waiting to run
Run tests / test_docs (3.13) (push) Waiting to run
This commit is contained in:
parent
5279fd372a
commit
f100cc1836
128 changed files with 3076 additions and 2599 deletions
|
@ -1,10 +1,10 @@
|
|||
import re
|
||||
import time
|
||||
|
||||
import pytest
|
||||
from django.core.cache import caches
|
||||
from django.template import Template
|
||||
from django.template.context import Context
|
||||
import pytest
|
||||
|
||||
from django_components import Component, register
|
||||
from django_components.testing import djc_test
|
||||
|
@ -209,7 +209,6 @@ class TestComponentCache:
|
|||
assert component.cache.get_entry(expected_key) == "<!-- _RENDERED TestComponent_28880f,ca1bc3f,, -->Hello"
|
||||
|
||||
def test_cached_component_inside_include(self):
|
||||
|
||||
@register("test_component")
|
||||
class TestComponent(Component):
|
||||
template = "Hello"
|
||||
|
@ -223,7 +222,7 @@ class TestComponentCache:
|
|||
{% block content %}
|
||||
THIS_IS_IN_ACTUAL_TEMPLATE_SO_SHOULD_NOT_BE_OVERRIDDEN
|
||||
{% endblock %}
|
||||
"""
|
||||
""",
|
||||
)
|
||||
|
||||
result = template.render(Context({}))
|
||||
|
@ -251,7 +250,7 @@ class TestComponentCache:
|
|||
{% component "test_component" input="cake" %}
|
||||
ONE
|
||||
{% endcomponent %}
|
||||
"""
|
||||
""",
|
||||
).render(Context({}))
|
||||
|
||||
Template(
|
||||
|
@ -259,7 +258,7 @@ class TestComponentCache:
|
|||
{% component "test_component" input="cake" %}
|
||||
ONE
|
||||
{% endcomponent %}
|
||||
"""
|
||||
""",
|
||||
).render(Context({}))
|
||||
|
||||
# Check if the cache entry is set
|
||||
|
@ -277,7 +276,7 @@ class TestComponentCache:
|
|||
{% component "test_component" input="cake" %}
|
||||
TWO
|
||||
{% endcomponent %}
|
||||
"""
|
||||
""",
|
||||
).render(Context({}))
|
||||
|
||||
assert len(cache._cache) == 2
|
||||
|
@ -339,12 +338,12 @@ class TestComponentCache:
|
|||
return {"input": kwargs["input"]}
|
||||
|
||||
with pytest.raises(
|
||||
ValueError,
|
||||
TypeError,
|
||||
match=re.escape(
|
||||
"Cannot hash slot 'content' of component 'TestComponent' - Slot functions are unhashable."
|
||||
"Cannot hash slot 'content' of component 'TestComponent' - Slot functions are unhashable.",
|
||||
),
|
||||
):
|
||||
TestComponent.render(
|
||||
kwargs={"input": "cake"},
|
||||
slots={"content": lambda ctx: "ONE"},
|
||||
slots={"content": lambda _ctx: "ONE"},
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue