MCPcopy Create free account
hub / github.com/python-cmd2/cmd2 / test_init_with_custom_settings

Method test_init_with_custom_settings

tests/test_pt_utils.py:502–515  ·  view source on GitHub ↗

Test initializing with custom settings.

(self, mock_cmd_app: MockCmd)

Source from the content-addressed store, hash-verified

500 assert completions[0].text == expected
501
502 def test_init_with_custom_settings(self, mock_cmd_app: MockCmd) -> None:
503 """Test initializing with custom settings."""
504 mock_parser = Mock()
505 custom_settings = utils.CustomCompletionSettings(parser=mock_parser)
506 completer = pt_utils.Cmd2Completer(cast(Any, mock_cmd_app), custom_settings=custom_settings)
507
508 document = Document("", cursor_position=0)
509
510 mock_cmd_app.complete.return_value = cmd2.Completions()
511
512 list(completer.get_completions(document, None))
513
514 mock_cmd_app.complete.assert_called_once()
515 assert mock_cmd_app.complete.call_args[1]["custom_settings"] == custom_settings
516
517 def test_get_completions_custom_delimiters(self, mock_cmd_app: MockCmd) -> None:
518 """Test that custom delimiters (terminators) are respected."""

Callers

nothing calls this directly

Calls 1

get_completionsMethod · 0.95

Tested by

no test coverage detected