Example #1
0
 def test_history_search_backward (self):
     q = LineHistory()
     for x in [u"aaaa",u"aaba",u"aaca",u"    aacax",u"akca",u"bbb",u"ako"]:
         q.add_history(RL(x))
     a=RL(u"aa",point=2)
     for x in [u"aaca",u"aaba",u"aaaa",u"aaaa"]:
         res=q.history_search_backward(a)
         assert res.get_line_text()==x
Example #2
0
 def test_history_search_backward(self):
     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)
         assert res.get_line_text() == x
 def test_history_search_backward(self):
     #  TODO. the for loops are ripe for self.subtests
     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)
         assert res.get_line_text() == x
 def test_history_search_forward (self):
     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)
         assert res.get_line_text()==x
Example #5
0
 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)
         assert res.get_line_text()==x
 def test_history_search_forward (self):
     q = LineHistory()
     for x in [u"aaaa",u"aaba",u"aaca",u"    aacax",u"akca",u"bbb",u"ako"]:
         q.add_history(RL(x))
     q.beginning_of_history()
     a=RL(u"aa",point=2)
     for x in [u"aaba",u"aaca",u"aaca"]:
         res=q.history_search_forward(a)
         assert res.get_line_text()==x
Example #7
0
 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)
         assert res.get_line_text() == x
Example #8
0
class TestLineHistoryDunderMethods(unittest.TestCase):
    def setUp(self):
        self.buf = LineHistory()

    def test_index(self):
        # Does get_history_item say, index starts at 1?
        # FFS this passed
        with self.assertRaises(IndexError):
            self.buf.get_history_item(0)

    def test_adding_only_a_string_to_the_history(self):
        # like we jump through some acrobatic hoops for seemingly no reason
        self.buf.add_history("a simple str")
        self.assertEqual(self.buf.get_history_item(0), "a simple str")