MCPcopy
hub / github.com/reflex-dev/reflex / test_dict

Function test_dict

tests/units/test_state.py:453–475  ·  view source on GitHub ↗

Test that the dict representation of a state is correct. Args: test_state: A state.

(test_state: TestState)

Source from the content-addressed store, hash-verified

451
452
453def test_dict(test_state: TestState):
454 """Test that the dict representation of a state is correct.
455
456 Args:
457 test_state: A state.
458 """
459 substates = {
460 test_state.get_full_name(),
461 ChildState.get_full_name(),
462 GrandchildState.get_full_name(),
463 ChildState2.get_full_name(),
464 GrandchildState2.get_full_name(),
465 ChildState3.get_full_name(),
466 GrandchildState3.get_full_name(),
467 }
468 test_state_dict = test_state.dict()
469 assert set(test_state_dict) == substates
470 assert set(test_state_dict[test_state.get_name()]) == {
471 var + FIELD_MARKER for var in test_state.vars
472 }
473 assert set(test_state.dict(include_computed=False)[test_state.get_name()]) == {
474 var + FIELD_MARKER for var in test_state.base_vars
475 }
476
477
478def test_class_indexing_with_vars():

Callers

nothing calls this directly

Calls 3

get_full_nameMethod · 0.80
get_nameMethod · 0.80
dictMethod · 0.45

Tested by

no test coverage detected