forked from philogb/jit
-
Notifications
You must be signed in to change notification settings - Fork 1
/
serve.py
executable file
·42 lines (31 loc) · 1.22 KB
/
serve.py
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
import web
from web import template
from tests import tests_model
from build import Build
urls = (
'/testcase/(RGraph|Treemap|Icicle|Hypertree|Spacetree|ForceDirected|Sunburst|AreaChart|BarChart|PieChart|Other)/([0-9]+)/?', 'testcase',
)
app = web.application(urls, globals())
render = {
'TestCases': template.render('Templates/'),
}
class testcase:
def GET(self, type, number):
number_int = int(number)
max = len(tests_model[type])
if number_int > max:
return "Wrong test number"
name = type
test = 'test' + number + '.js'
model = tests_model[type][number_int -1]
title = model['Title']
extras = model['Extras'][:]
if 'Build' in model: build_config = model['Build']
else: build_config = [type]
build = Build().build(build_config)
includes = {
'left': getattr(render['TestCases'], type + '/' + 'left')(model, type, number_int, max),
'right': getattr(render['TestCases'], type + '/' + 'test' + number)(model),
}
return render['TestCases'].basetests(name, title, extras, test, build, includes)
if __name__ == "__main__": app.run()