<s> """<STR_LIT>""" <EOL> import os <EOL> import unittest <EOL> from test . test_support import run_unittest , import_module <EOL> from test . script_helper import assert_python_ok <EOL> readline = import_module ( '<STR_LIT>' ) <EOL> class TestHistoryManipulation ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> @ unittest . skipUnless ( hasattr ( readline , "<STR_LIT>" ) , <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> def testHistoryUpdates ( self ) : <EOL> readline . clear_history ( ) <EOL> readline . add_history ( "<STR_LIT>" ) <EOL> readline . add_history ( "<STR_LIT>" ) <EOL> self . assertEqual ( readline . get_history_item ( <NUM_LIT:0> ) , None ) <EOL> self . assertEqual ( readline . get_history_item ( <NUM_LIT:1> ) , "<STR_LIT>" ) <EOL> self . assertEqual ( readline . get_history_item ( <NUM_LIT:2> ) , "<STR_LIT>" ) <EOL> readline . replace_history_item ( <NUM_LIT:0> , "<STR_LIT>" ) <EOL> self . assertEqual ( readline . get_history_item ( <NUM_LIT:0> ) , None ) <EOL> self . assertEqual ( readline . get_history_item ( <NUM_LIT:1> ) , "<STR_LIT>" ) <EOL> self . assertEqual ( readline . get_history_item ( <NUM_LIT:2> ) , "<STR_LIT>" ) <EOL> self . assertEqual ( readline . get_current_history_length ( ) , <NUM_LIT:2> ) <EOL> readline . remove_history_item ( <NUM_LIT:0> ) <EOL> self . assertEqual ( readline . get_history_item ( <NUM_LIT:0> ) , None ) <EOL> self . assertEqual ( readline . get_history_item ( <NUM_LIT:1> ) , "<STR_LIT>" ) <EOL> self . assertEqual ( readline . get_current_history_length ( ) , <NUM_LIT:1> ) <EOL> class TestReadline ( unittest . TestCase ) : <EOL> @ unittest . skipIf ( readline . _READLINE_VERSION < <NUM_LIT> <EOL> and "<STR_LIT>" not in readline . __doc__ , <EOL> "<STR_LIT>" ) <EOL> def test_init ( self ) : <EOL> rc , stdout , stderr = assert_python_ok ( '<STR_LIT:-c>' , '<STR_LIT>' , <EOL> TERM = '<STR_LIT>' ) <EOL> self . assertEqual ( stdout , b'<STR_LIT>' ) <EOL> def test_main ( ) : <EOL> run_unittest ( TestHistoryManipulation , TestReadline ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> test_main ( ) </s>
