-
Notifications
You must be signed in to change notification settings - Fork 21
/
Testing.py
60 lines (47 loc) · 2.27 KB
/
Testing.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import unittest
from Wiki_Info import scraper
class ScraperTests(unittest.TestCase):
def testNottingham(self):
print('Testing University of Nottingham')
uniinfo = scraper('University of Nottingham')
self.assertEqual(uniinfo['Motto'],'Sapientia urbs conditur (Latin)')
self.assertEqual(uniinfo['Chancellor'],'Sir Andrew Witty[2]')
self.assertEqual(uniinfo['Budget'],'£637.6 million (2016-17)[1]')
self.assertEqual(uniinfo['Location'],'Nottingham, England, UK')
print()
def testWarsaw(self):
print('Testing University of Warsaw')
uniinfo = scraper('University of Warsaw')
self.assertEqual(uniinfo['Type'],'Public')
self.assertEqual(uniinfo['Established'],'1816')
self.assertEqual(uniinfo['Location'],'Warsaw, Poland')
print()
def testSantoTomas(self):
print('Testing University of Santo Tomas')
uniinfo = scraper('University of Santo Tomas')
self.assertEqual(uniinfo['Motto'],'Veritas in Caritate')
self.assertEqual(uniinfo['Chancellor'],'Very Rev. Fr. Bruno Cadoré, O.P., M.D.')
self.assertEqual(uniinfo['Location'],'España Boulevard, Sampaloc, Manila, Philippines')
print()
def testPeking(self):
print('Testing Peking University')
uniinfo = scraper('Peking University')
self.assertEqual(uniinfo['President'],'Hao Ping')
self.assertEqual(uniinfo['Location'],'Haidian District, Beijing, China')
print()
def testChihuahua(self):
print('Testing Chihuahua Institute of Technology')
uniinfo = scraper('Chihuahua Institute of Technology')
self.assertEqual(uniinfo['Motto'],'La Técnica por el engrandecimiento de México')
self.assertEqual(uniinfo['Motto in\xa0English'],'Technology for the aggrandizement of Mexico')
self.assertEqual(uniinfo['Established'],'1948')
print()
def testPardubice(self):
print('Testing University of Pardubice')
uniinfo = scraper('University of Pardubice')
self.assertEqual(uniinfo['Established'],'1950')
self.assertEqual(uniinfo['Students'],'9,200')
self.assertEqual(uniinfo['Location'],'Pardubice, Czech Republic')
print()
if __name__ == '__main__':
unittest.main()