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

Function test_stateful_component

tests/components/test_component.py:615–630  ·  view source on GitHub ↗

Test that a stateful component is created correctly. Args: test_state: A test state.

(test_state)

Source from the content-addressed store, hash-verified

613
614
615def test_stateful_component(test_state):
616 """Test that a stateful component is created correctly.
617
618 Args:
619 test_state: A test state.
620 """
621 text_component = xt.text(test_state.num)
622 stateful_component = StatefulComponent.compile_from(text_component)
623 assert isinstance(stateful_component, StatefulComponent)
624 assert stateful_component.tag is not None
625 assert stateful_component.tag.startswith("Text_")
626 assert stateful_component.references == 1
627 sc2 = StatefulComponent.compile_from(xt.text(test_state.num))
628 assert isinstance(sc2, StatefulComponent)
629 assert stateful_component.references == 2
630 assert sc2.references == 2
631
632
633def test_stateful_component_memoize_event_trigger(test_state):

Callers

nothing calls this directly

Calls 2

textMethod · 0.80
compile_fromMethod · 0.80

Tested by

no test coverage detected