MCPcopy Index your code
hub / github.com/python-cmd2/cmd2 / test_get_settable_choices

Function test_get_settable_choices

tests/test_cmd2.py:2742–2763  ·  view source on GitHub ↗
(base_app: cmd2.Cmd)

Source from the content-addressed store, hash-verified

2740
2741
2742def test_get_settable_choices(base_app: cmd2.Cmd) -> None:
2743 choices = base_app._get_settable_choices()
2744 assert len(choices) == len(base_app.settables)
2745
2746 for cur_choice in choices:
2747 cur_settable = base_app.settables.get(cur_choice.text)
2748 assert cur_settable is not None
2749
2750 # Convert fields so we can compare them
2751 str_value = str(cur_settable.value)
2752
2753 choice_value = cur_choice.table_data[0]
2754 if isinstance(choice_value, Text):
2755 choice_value = ru.rich_text_to_string(choice_value)
2756
2757 choice_description = cur_choice.table_data[1]
2758 if isinstance(choice_description, Text):
2759 choice_description = ru.rich_text_to_string(choice_description)
2760
2761 assert str_value in cur_choice.display_meta
2762 assert choice_value == str_value
2763 assert choice_description == cur_settable.description
2764
2765
2766def test_alias_no_subcommand(base_app) -> None:

Callers

nothing calls this directly

Calls 2

_get_settable_choicesMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…