home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
- import sys
- import unittest
- sys.path.append('../..')
- from pyreadline.lineeditor import lineobj
- from pyreadline.lineeditor.history import LineHistory
- import pyreadline.lineeditor.history as history
- import pyreadline.logger as pyreadline
- pyreadline.logger.sock_silent = False
- from pyreadline.logger import log_sock
- RL = lineobj.ReadLineTextBuffer
-
- class Test_linepos(unittest.TestCase):
- t = 'test text'
-
- def init_test(self):
- history._ignore_leading_spaces = False
- self.q = q = LineHistory()
- for x in [
- 'aaaa',
- 'aaba',
- 'aaca',
- 'akca',
- 'bbb',
- 'ako']:
- q.add_history(RL(x))
-
-
-
- def test_previous_history(self):
- self.init_test()
- hist = self.q
- l = RL('')
- hist.previous_history(l)
- hist.previous_history(l)
- hist.previous_history(l)
- hist.previous_history(l)
- hist.previous_history(l)
- hist.previous_history(l)
- hist.previous_history(l)
-
-
- def test_next_history(self):
- self.init_test()
- hist = self.q
- hist.beginning_of_history()
- l = RL('')
- hist.next_history(l)
- hist.next_history(l)
- hist.next_history(l)
- hist.next_history(l)
- hist.next_history(l)
- hist.next_history(l)
-
-
- def init_test2(self):
- self.q = q = LineHistory()
- for x in [
- 'aaaa',
- 'aaba',
- 'aaca',
- 'akca',
- 'bbb',
- 'ako']:
- q.add_history(RL(x))
-
-
-
- def test_history_search_backward(self):
- history._ignore_leading_spaces = False
- q = LineHistory()
- for x in [
- 'aaaa',
- 'aaba',
- 'aaca',
- ' aacax',
- 'akca',
- 'bbb',
- 'ako']:
- q.add_history(RL(x))
-
- a = RL('aa', point = 2)
- for x in [
- 'aaca',
- 'aaba',
- 'aaaa',
- 'aaaa']:
- res = q.history_search_backward(a)
-
-
-
- def test_history_search_forward(self):
- history._ignore_leading_spaces = False
- q = LineHistory()
- for x in [
- 'aaaa',
- 'aaba',
- 'aaca',
- ' aacax',
- 'akca',
- 'bbb',
- 'ako']:
- q.add_history(RL(x))
-
- q.beginning_of_history()
- a = RL('aa', point = 2)
- for x in [
- 'aaba',
- 'aaca',
- 'aaca']:
- res = q.history_search_forward(a)
-
-
-
- if __name__ == '__main__':
- unittest.main()
- l = lineobj.ReadLineTextBuffer('First Second Third')
-
-