-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSugarLabs Table
156 lines (143 loc) · 2.26 KB
/
SugarLabs Table
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
'Code barrowed and changed some to fit needs from http://anh.cs.luc.edu/'
'Additional code learned from w3schools'
contents = '''<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type">
<style>
table {
border-collapse: collapse;
}
table, td, th {
border: 1px solid black;
}
table {
width: 60%;
height: 40px;
}
</style>
<title>SugarLabs Test Cases</title>
</head>
<body>
<table>
<tr>
<th>
Test Case
number
</th>
<th>
Description
</th>
<th>
Expected
Output
</th>
<th>
Test Results
</th>
<th>
Pass/Fail
</th>
</tr>
<tr>
<td>
1
</td>
<td>
Test that passing two whole integers will return their sum
</td>
<td>
4
</td>
<td>
Test Results
</td>
<td>
Pass/fail
</td>
</tr>
<tr>
<td>
2
</td>
<td>
Test that passing one number and one string will return a Type Error
</td>
<td>
Type Error
</td>
<td>
Test Results
</td>
<td>
Pass/fail
</td>
</tr>
<tr>
<td>
3
</td>
<td>
Test that adding two negative numbers returns the correct negative sum
</td>
<td>
-2
</td>
<td>
Test Results
</td>
<td>
Pass/fail
</td>
</tr>
<tr>
<td>
4
</td>
<td>
Test that the sum of zero and an integer return that integer
</td>
<td>
7
</td>
<td>
Test Results
</td>
<td>
Pass/fail
</td>
</tr>
<tr>
<td>
5
</td>
<td>
Test that two very precise decimals will have a sum of zero
</td>
<td>
1
</td>
<td>
Test Results
</td>
<td>
Pass/fail
</td>
</tr>
</table>
</body>
</html>
'''
def main():
browseLocal(contents)
def strToFile(text, filename):
"""Write a file with the given name and the given text."""
output = open(filename,"w")
output.write(text)
output.close()
def browseLocal(webpageText, filename='sugarlabsTest.html'):
import webbrowser, os.path
strToFile(webpageText, filename)
webbrowser.open("file:///" + os.path.abspath(filename))
main()