Test that the dict representation of a state is correct. Args: test_state: A state.
(test_state: TestState)
| 451 | |
| 452 | |
| 453 | def 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 | |
| 478 | def test_class_indexing_with_vars(): |
nothing calls this directly
no test coverage detected