refactor: cleanup docs, add docs on Render API, allow get_context_data return None (#1110)

* refactor: cleanup docs, add docs on Render API, allow get_context_data return None

* refactor: fix linter and tests
This commit is contained in:
Juro Oravec 2025-04-09 15:06:14 +02:00 committed by GitHub
parent 9ede779fa3
commit 613dfea379
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 604 additions and 226 deletions

View file

@ -362,6 +362,18 @@ class TestComponent:
assert get_component_by_class_id(SimpleComponent.class_id) == SimpleComponent
def test_get_component_by_id_raises_on_missing_component(self):
with pytest.raises(KeyError):
get_component_by_class_id("nonexistent")
def test_get_context_data_returns_none(self):
class SimpleComponent(Component):
template = "Hello"
def get_context_data(self):
return None
assert SimpleComponent.render() == "Hello"
@djc_test
class TestComponentRender: