def hist(): from cmd2.parsing import Statement from cmd2.cmd2 import History, HistoryItem h = History([HistoryItem(Statement('', raw='first'), 1), HistoryItem(Statement('', raw='second'), 2), HistoryItem(Statement('', raw='third'), 3), HistoryItem(Statement('', raw='fourth'),4)]) return h
def persisted_hist(): from cmd2.parsing import Statement from cmd2.cmd2 import History, HistoryItem h = History([HistoryItem(Statement('', raw='first'), 1), HistoryItem(Statement('', raw='second'), 2), HistoryItem(Statement('', raw='third'), 3), HistoryItem(Statement('', raw='fourth'),4)]) h.start_session() h.append(Statement('', raw='fifth')) h.append(Statement('', raw='sixth')) return h
def hist(): from cmd2.cmd2 import ( History, HistoryItem, ) from cmd2.parsing import ( Statement, ) h = History([ HistoryItem(Statement('', raw='first')), HistoryItem(Statement('', raw='second')), HistoryItem(Statement('', raw='third')), HistoryItem(Statement('', raw='fourth')), ]) return h
def test_history_item_instantiate(): from cmd2.parsing import Statement from cmd2.history import HistoryItem statement = Statement('history', raw='help history', command='help', arg_list=['history'], ) with pytest.raises(TypeError): _ = HistoryItem() with pytest.raises(TypeError): _ = HistoryItem(idx=1) with pytest.raises(TypeError): _ = HistoryItem(statement=statement) with pytest.raises(TypeError): _ = HistoryItem(statement=statement, idx='hi')
def histitem(): from cmd2.parsing import Statement from cmd2.history import HistoryItem statement = Statement('history', raw='help history', command='help', arg_list=['history'], ) histitem = HistoryItem(statement, 1) return histitem
def test_history_item_instantiate(): from cmd2.history import ( HistoryItem, ) from cmd2.parsing import ( Statement, ) statement = Statement( 'history', raw='help history', command='help', arg_list=['history'], ) with pytest.raises(TypeError): _ = HistoryItem()