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

Method test_load_history_strings

tests/test_pt_utils.py:531–540  ·  view source on GitHub ↗

Test loading history strings yields all items newest to oldest.

(self)

Source from the content-addressed store, hash-verified

529
530class TestCmd2History:
531 def test_load_history_strings(self):
532 """Test loading history strings yields all items newest to oldest."""
533
534 history_strings = ["cmd1", "cmd2", "cmd2", "cmd3", "cmd2"]
535 history = pt_utils.Cmd2History(history_strings)
536 assert history._loaded
537
538 # Consecutive duplicates are removed
539 expected = ["cmd2", "cmd3", "cmd2", "cmd1"]
540 assert list(history.load_history_strings()) == expected
541
542 def test_load_history_strings_empty(self):
543 """Test loading history strings with empty history."""

Callers

nothing calls this directly

Calls 1

load_history_stringsMethod · 0.95

Tested by

no test coverage detected