-
Notifications
You must be signed in to change notification settings - Fork 0
/
calvins-TestWC1.py
153 lines (141 loc) · 3.56 KB
/
calvins-TestWC1.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
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
import unittest
from helloworld import *
from xml.etree.ElementTree import ElementTree
import xml.etree.ElementTree
class TestWC1(unittest.TestCase):
def testName(self):
self.assertTrue(True)
def test_feature_one(self):
cris = Crisis()
cris.name = "Deepwater Horizon Oil Spill"
self.assertTrue(cris.name == "Deepwater Horizon Oil Spill")
def test_feature_two(self):
cris = Crisis()
cris.misc = ""
self.assertTrue(cris.misc == "")
def test_feature_third(self):
org = Organization()
self.assertTrue(org.name != "")
def test_feature_fourth(self):
org = Organization()
self.assertTrue(org.name is None)
def test_feature_fifth(self):
peps = Person()
peps.name = "Connor Bowman"
self.assertTrue(peps.name is "Connor Bowman")
def test_feature_six(self):
t = Time()
t.month = "4"
self.assertTrue(t.month == "4")
def test_feature_seven(self):
t = Time()
t.day = "30"
self.assertTrue(t.day == "30")
def test_feature_twenty(self):
t = Time()
t.year = "1970"
self.assertTrue(t.year == "1970")
def test_feature_eight(self):
t = Time()
t.time = "11:30"
self.assertTrue(t.time == "11:30")
def test_feature_nine(self):
m = Mail()
m.address = "1 Main St."
self.assertTrue(m.address == "1 Main St.")
def test_feature_ten(self):
m = Mail()
m.city = "Austin"
self.assertTrue(m.city == "Austin")
def test_feature_eleven(self):
m = Mail()
m.state = "TX"
self.assertTrue(m.state == "TX")
def test_feature_twelve(self):
m = Mail()
m.country = "USA"
self.assertTrue(m.country == "USA")
def test_feature_thirteen(self):
m = Mail()
m.mail_zip = "78705"
self.assertTrue(m.mail_zip == "78705")
def fourteen(self):
l = Location()
l.city = "Austin"
self.assertTrue(l.city == "Austin")
def test_feature_eight(self):
p = xml.etree.ElementTree.fromstring(""" <crisis id = "deepwater">
<name>Deepwater Horizon Oil Spill</name>
<info>
<history></history>
<help> Volunteering along the gulf to help clean</help>
<resources> Help cleaning spill and wildlife</resources>
<type>Wellhead Blowout and Oil Spill</type>
<time>
<time></time>
<day>20</day>
<month>4</month>
<year>2010</year>
<misc></misc>
</time>
<loc>
<city></city>
<region>Gulf of Mexico</region>
<country></country>
</loc>
<impact>
<human>
<deaths>11</deaths>
<displaced>0</displaced>
<injured>0</injured>
<missing>0</missing>
<misc></misc>
</human>
<economic>
<amount>30000000000</amount>
<currency>dollars</currency>
<misc></misc>
</economic>
</impact>
</info>
<ref>
<primaryImage>
<site></site>
<title></title>
<url></url>
<description></description>
</primaryImage>
<image>
<site></site>
<title>Deepwater Horizon</title>
<url>http://www.thebuzzmedia.com/wp-content/uploads/2010/06/bp-oil-spill-bird-covered-in-oil.jpg</url>
<description></description>
</image>
<video>
<site>Youtube</site>
<title></title>
<url>http://www.youtube.com/watch?v=lY-PikuXTYY</url>
<description></description>
</video>
<social>
<site></site>
<title>Facebook</title>
<url>http://www.facebook.com/BPOilCrisisInTheGulf?ref=ts</url>
<description></description>
</social>
<ext>
<site></site>
<title>Wikipedia</title>
<url>http://en.wikipedia.org/wiki/Deepwater_Horizon_oil_spill#Consequences</url>
<description></description>
</ext>
</ref>
<misc></misc>
<org idref = "bp"/>
<person idref = "feinberg"/>
</crisis>""")
d = p.find("name")
self.assertTrue(d.text == "Deepwater Horizon Oil Spill")
if __name__ == "__main__":
#import sys;sys.argv = ['', 'TestWC1.testName']
unittest.main()