def test_hist_append(hist, xonsh_builtins):
 xonsh_builtins.__xonsh_env__['HISTCONTROL'] = set()
 hf = hist.append({'inp': 'still alive', 'rtn': 1})
 assert (hf is None)
 items = list(hist.items())
 assert (len(items) == 1)
 assert ('still alive' == items[0]['inp'])
 assert (1 == items[0]['rtn'])
 hist.append({'inp': 'still alive', 'rtn': 0})
 items = list(hist.items())
 assert (len(items) == 2)
 assert ('still alive' == items[1]['inp'])
 assert (0 == items[1]['rtn'])
 assert (list(hist.all_items()) == items)

def test_hist_append ( hist , xonsh_builtins ) : xonsh_builtins . __xonsh_env__ [ 'HISTCONTROL' ] = set ( ) hf = hist . append ( { 'inp' : 'still alive' , 'rtn' : 1 } ) assert ( hf is None ) items = list ( hist . items ( ) ) assert ( len ( items ) == 1 ) assert ( 'still alive' == items [ 0 ] [ 'inp' ] ) assert ( 1 == items [ 0 ] [ 'rtn' ] ) hist . append ( { 'inp' : 'still alive' , 'rtn' : 0 } ) items = list ( hist . items ( ) ) assert ( len ( items ) == 2 ) assert ( 'still alive' == items [ 1 ] [ 'inp' ] ) assert ( 0 == items [ 1 ] [ 'rtn' ] ) assert ( list ( hist . all_items ( ) ) == items )
verify appending to the history works .