Menu

[r5]: / test_switch.py  Maximize  Restore  History

Download this file

70 lines (45 with data), 1.7 kB

 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import os
import StyleSheet
import pdb
def whiteStrip(txt):
text = txt
text = " ".join(text.split())
return text
def main():
failed = {}
files = os.listdir('_test')
for i in xrange(len(files)):
path = os.path.join('_test', files[i])
if os.path.isfile(path) and os.path.splitext(path)[1] == '.sss':
#pdb.set_trace()
css = os.path.join(os.path.splitext(path)[0] + '.css')
if os.path.isfile(css):
styles = StyleSheet.SSSStyleSheet(path)
result = styles.cssText
result = whiteStrip(result)
# open the CSS file
compare_to = open(css, 'r')
base = compare_to.read()
base = whiteStrip(base)
if result == base:
print '.',
else:
print 'F',
failed[path] = result, base
else:
print "\nCannot find the file: " + css
break
if failed:
for path, output in failed.items():
print "\n\n============================================"
print "The following file FAILED:"
print path
print "--------------------------------------------"
print "The output was:"
print output[0]
print "--------------------------------------------"
print "The expected output was:"
print output[1]
print "============================================"
if __name__ == '__main__':
main()
MongoDB Logo MongoDB