about summary refs log tree commit diff stats
path: root/lua/chupacabra/scratch.lua
blob: 9dbe72474d8364778ee6b47c8a8d9a08e9666963 (plain) (blame)
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
5'>25
26
27
28
29
30
31






























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

from unittest import TestCase, main
import random
import ranger.colorschemes
from ranger.gui.colorscheme import ColorScheme, CONTEXT_KEYS

class Test(TestCase):
	def setUp(self):
		import random
		schemes = []
		for key, mod in vars(ranger.colorschemes).items():
			if type(mod) == type(random):
				for key, var in vars(mod).items():
					if type(var) == type and issubclass(var, ColorScheme) \
							and var != ColorScheme:
						schemes.append(var)
		self.schemes = set(schemes)

	def test_colorschemes(self):
		def test(scheme):
			scheme.get()  # test with no arguments

			for i in range(300):  # test with a bunch of random (valid) arguments
				sample = random.sample(CONTEXT_KEYS, random.randint(2, 9))
				scheme.get(*sample)

		for scheme in self.schemes:
			test(scheme())

if __name__ == '__main__': main()