summary refs log tree commit diff stats
path: root/test/testlib.py
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-10-14 23:50:51 +0200
committerhut <hut@lavabit.com>2010-10-14 23:50:51 +0200
commit25d023b34085b715ca995616ab37aa73f5b66f49 (patch)
treeed6260d7b6e3b6de933815a44a49717a19e8aca5 /test/testlib.py
parent1dd8d9f4b83f8b0cd38124a09fcb957ad4df6ad9 (diff)
downloadranger-25d023b34085b715ca995616ab37aa73f5b66f49.tar.gz
Renamed ranger/ext/signal_dispatcher to ranger/ext/signals
Diffstat (limited to 'test/testlib.py')
0 files changed, 0 insertions, 0 deletions
vision' href='/akspecs/ranger/blame/test/tc_history.py?h=v1.8.1&id=16246965082ce5d319f5cef07da3ff533ca50cc2'>^
22bb7e35 ^

3dbefa71 ^

22bb7e35 ^
3dbefa71 ^
22bb7e35 ^

3dbefa71 ^


22bb7e35 ^
3dbefa71 ^
22bb7e35 ^
3dbefa71 ^
22bb7e35 ^


3dbefa71 ^
22bb7e35 ^








1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
                                                            
 
                                    



                                   
                               






                                                     
                                                   

                                                   

                                               
                           
                                                   

                                                 


                                                               
                           
                                                      
 
                                               


                              
                                                   








                                                     
if __name__ == '__main__': from __init__ import init; init()

from ranger.container import History
from unittest import TestCase, main
import unittest

class Test(TestCase):
	def test_history(self):
		hist = History(3)
		for i in range(6):
			hist.add(i)
		self.assertEqual([3,4,5], list(hist))

		hist.back()

		self.assertEqual(4, hist.current())
		self.assertEqual([3,4], list(hist))

		self.assertEqual(5, hist.top())

		hist.back()
		self.assertEqual(3, hist.current())
		self.assertEqual([3], list(hist))

		# no change if current == bottom
		self.assertEqual(hist.current(), hist.bottom())
		last = hist.current()
		hist.back()
		self.assertEqual(hist.current(), last)

		self.assertEqual(5, hist.top())

		hist.forward()
		hist.forward()
		self.assertEqual(5, hist.current())
		self.assertEqual([3,4,5], list(hist))


		self.assertEqual(3, hist.bottom())
		hist.add(6)
		self.assertEqual(4, hist.bottom())
		self.assertEqual([4,5,6], list(hist))

if __name__ == '__main__': main()