MCPcopy Create free account
hub / github.com/dot-agent/nextpy / test_custom_component_wrapper

Function test_custom_component_wrapper

tests/components/test_component.py:465–483  ·  view source on GitHub ↗

Test that the wrapper of a custom component is correct.

()

Source from the content-addressed store, hash-verified

463
464
465def test_custom_component_wrapper():
466 """Test that the wrapper of a custom component is correct."""
467
468 @custom_component
469 def my_component(width: Var[int], color: Var[str]):
470 return xt.box(
471 width=width,
472 color=color,
473 )
474
475 ccomponent = my_component(
476 xt.text("child"), width=Var.create(1), color=Var.create("red")
477 )
478 assert isinstance(ccomponent, CustomComponent)
479 assert len(ccomponent.children) == 1
480 assert isinstance(ccomponent.children[0], xt.Text)
481
482 component = ccomponent.get_component(ccomponent)
483 assert isinstance(component, Box)
484
485
486def test_invalid_event_handler_args(component2, test_state):

Callers

nothing calls this directly

Calls 5

my_componentFunction · 0.85
lenFunction · 0.85
textMethod · 0.80
createMethod · 0.45
get_componentMethod · 0.45

Tested by

no test coverage detected