home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2010 November / maximum-cd-2010-11.iso / DiscContents / calibre-0.7.13.msi / file_2359 (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-08-06  |  3.2 KB  |  121 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import sys
  5. import unittest
  6. sys.path.append('../..')
  7. from pyreadline.lineeditor import lineobj
  8. from pyreadline.lineeditor.history import LineHistory
  9. import pyreadline.lineeditor.history as history
  10. import pyreadline.logger as pyreadline
  11. pyreadline.logger.sock_silent = False
  12. from pyreadline.logger import log_sock
  13. RL = lineobj.ReadLineTextBuffer
  14.  
  15. class Test_linepos(unittest.TestCase):
  16.     t = 'test text'
  17.     
  18.     def init_test(self):
  19.         history._ignore_leading_spaces = False
  20.         self.q = q = LineHistory()
  21.         for x in [
  22.             'aaaa',
  23.             'aaba',
  24.             'aaca',
  25.             'akca',
  26.             'bbb',
  27.             'ako']:
  28.             q.add_history(RL(x))
  29.         
  30.  
  31.     
  32.     def test_previous_history(self):
  33.         self.init_test()
  34.         hist = self.q
  35.         l = RL('')
  36.         hist.previous_history(l)
  37.         hist.previous_history(l)
  38.         hist.previous_history(l)
  39.         hist.previous_history(l)
  40.         hist.previous_history(l)
  41.         hist.previous_history(l)
  42.         hist.previous_history(l)
  43.  
  44.     
  45.     def test_next_history(self):
  46.         self.init_test()
  47.         hist = self.q
  48.         hist.beginning_of_history()
  49.         l = RL('')
  50.         hist.next_history(l)
  51.         hist.next_history(l)
  52.         hist.next_history(l)
  53.         hist.next_history(l)
  54.         hist.next_history(l)
  55.         hist.next_history(l)
  56.  
  57.     
  58.     def init_test2(self):
  59.         self.q = q = LineHistory()
  60.         for x in [
  61.             'aaaa',
  62.             'aaba',
  63.             'aaca',
  64.             'akca',
  65.             'bbb',
  66.             'ako']:
  67.             q.add_history(RL(x))
  68.         
  69.  
  70.     
  71.     def test_history_search_backward(self):
  72.         history._ignore_leading_spaces = False
  73.         q = LineHistory()
  74.         for x in [
  75.             'aaaa',
  76.             'aaba',
  77.             'aaca',
  78.             '    aacax',
  79.             'akca',
  80.             'bbb',
  81.             'ako']:
  82.             q.add_history(RL(x))
  83.         
  84.         a = RL('aa', point = 2)
  85.         for x in [
  86.             'aaca',
  87.             'aaba',
  88.             'aaaa',
  89.             'aaaa']:
  90.             res = q.history_search_backward(a)
  91.         
  92.  
  93.     
  94.     def test_history_search_forward(self):
  95.         history._ignore_leading_spaces = False
  96.         q = LineHistory()
  97.         for x in [
  98.             'aaaa',
  99.             'aaba',
  100.             'aaca',
  101.             '    aacax',
  102.             'akca',
  103.             'bbb',
  104.             'ako']:
  105.             q.add_history(RL(x))
  106.         
  107.         q.beginning_of_history()
  108.         a = RL('aa', point = 2)
  109.         for x in [
  110.             'aaba',
  111.             'aaca',
  112.             'aaca']:
  113.             res = q.history_search_forward(a)
  114.         
  115.  
  116.  
  117. if __name__ == '__main__':
  118.     unittest.main()
  119.     l = lineobj.ReadLineTextBuffer('First Second Third')
  120.  
  121.