mirror of
https://github.com/django-components/django-components.git
synced 2025-09-26 15:39:08 +00:00
refactor: fix mypy errors
This commit is contained in:
parent
486fb236bc
commit
7b62cdbc8e
2 changed files with 17 additions and 17 deletions
|
@ -3419,7 +3419,7 @@ class Component(metaclass=ComponentMeta):
|
||||||
# Required for compatibility with Django's {% extends %} tag
|
# Required for compatibility with Django's {% extends %} tag
|
||||||
# See https://github.com/django-components/django-components/pull/859
|
# See https://github.com/django-components/django-components/pull/859
|
||||||
context.render_context.push( # type: ignore[union-attr]
|
context.render_context.push( # type: ignore[union-attr]
|
||||||
{BLOCK_CONTEXT_KEY: context.render_context.get(BLOCK_CONTEXT_KEY, BlockContext())},
|
{BLOCK_CONTEXT_KEY: context.render_context.get(BLOCK_CONTEXT_KEY, BlockContext())}, # type: ignore[union-attr]
|
||||||
)
|
)
|
||||||
|
|
||||||
# We pass down the components the info about the component's parent.
|
# We pass down the components the info about the component's parent.
|
||||||
|
|
|
@ -949,13 +949,13 @@ class TestSignatureBasedValidation:
|
||||||
template3.render(Context({}))
|
template3.render(Context({}))
|
||||||
|
|
||||||
params3, nodelist3, node_id3, contents3, template_name3, template_component3 = captured # type: ignore[misc]
|
params3, nodelist3, node_id3, contents3, template_name3, template_component3 = captured # type: ignore[misc]
|
||||||
assert len(params3) == 1
|
assert len(params3) == 1 # type: ignore[has-type]
|
||||||
assert isinstance(params3[0], TagAttr)
|
assert isinstance(params3[0], TagAttr) # type: ignore[has-type]
|
||||||
assert len(nodelist3) == 0
|
assert len(nodelist3) == 0 # type: ignore[has-type]
|
||||||
assert contents3 is None
|
assert contents3 is None # type: ignore[has-type]
|
||||||
assert node_id3 == "a1bc40"
|
assert node_id3 == "a1bc40" # type: ignore[has-type]
|
||||||
assert template_name3 == "<unknown source>"
|
assert template_name3 == "<unknown source>" # type: ignore[has-type]
|
||||||
assert template_component3 is None
|
assert template_component3 is None # type: ignore[has-type]
|
||||||
|
|
||||||
# Case 4 - Node nested in Component end tag
|
# Case 4 - Node nested in Component end tag
|
||||||
class TestComponent(Component):
|
class TestComponent(Component):
|
||||||
|
@ -967,19 +967,19 @@ class TestSignatureBasedValidation:
|
||||||
TestComponent.render(Context({}))
|
TestComponent.render(Context({}))
|
||||||
|
|
||||||
params4, nodelist4, node_id4, contents4, template_name4, template_component4 = captured # type: ignore[misc]
|
params4, nodelist4, node_id4, contents4, template_name4, template_component4 = captured # type: ignore[misc]
|
||||||
assert len(params4) == 1
|
assert len(params4) == 1 # type: ignore[has-type]
|
||||||
assert isinstance(params4[0], TagAttr)
|
assert isinstance(params4[0], TagAttr) # type: ignore[has-type]
|
||||||
assert len(nodelist4) == 0
|
assert len(nodelist4) == 0 # type: ignore[has-type]
|
||||||
assert contents4 is None
|
assert contents4 is None # type: ignore[has-type]
|
||||||
assert node_id4 == "a1bc42"
|
assert node_id4 == "a1bc42" # type: ignore[has-type]
|
||||||
|
|
||||||
if os.name == "nt":
|
if os.name == "nt":
|
||||||
assert cast("str", template_name4).endswith("\\tests\\test_node.py::TestComponent")
|
assert cast("str", template_name4).endswith("\\tests\\test_node.py::TestComponent") # type: ignore[has-type]
|
||||||
else:
|
else:
|
||||||
assert cast("str", template_name4).endswith("/tests/test_node.py::TestComponent")
|
assert cast("str", template_name4).endswith("/tests/test_node.py::TestComponent") # type: ignore[has-type]
|
||||||
|
|
||||||
assert template_name4 == f"{__file__}::TestComponent"
|
assert template_name4 == f"{__file__}::TestComponent" # type: ignore[has-type]
|
||||||
assert template_component4 is TestComponent
|
assert template_component4 is TestComponent # type: ignore[has-type]
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
TestNodeWithEndTag.unregister(component_tags.register)
|
TestNodeWithEndTag.unregister(component_tags.register)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue