|
|
|
|
38
|
self.assertEqual(bing_images.response(response), [])
|
38
|
self.assertEqual(bing_images.response(response), [])
|
39
|
|
39
|
|
40
|
html = """
|
40
|
html = """
|
41
|
- <div class="dg_u" style="width:178px;height:144px;left:17px;top:0px">
|
|
|
|
|
41
|
+ <div class="dg_u" style="width:178px;height:144px;left:17px;top:0px"><div>
|
42
|
<a href="/images/search?q=south&view=detailv2&&id=7E92863981CCFB89FBDD55205C742DFDA3290CF6&selectedIndex=9&ccid=vzvIfv5u&simid=608055786735667000&thid=OIP.Mbf3bc87efe6e0e476be8cc34bf6cd80eH0" ihk="OIP.Mbf3bc87efe6e0e476be8cc34bf6cd80eH0" t1="South Carolina" t2="747 x 589 · 29 kB · gif" t3="www.digital-topo-maps.com/county-map/south-carolina.shtml" hh="236" hw="300" m='{ns:"images",k:"5117",mid:"7E92863981CCFB89FBDD55205C742DFDA3290CF6",md5:"bf3bc87efe6e0e476be8cc34bf6cd80e",surl:"http://www.digital-topo-maps.com/county-map/south-carolina.shtml",imgurl:"http://www.digital-topo-maps.com/county-map/south-carolina-county-map.gif",tid:"OIP.Mbf3bc87efe6e0e476be8cc34bf6cd80eH0",ow:"480",docid:"608055786735667000",oh:"378",tft:"45"}' mid="7E92863981CCFB89FBDD55205C742DFDA3290CF6" h="ID=images,5117.1">
|
42
|
<a href="/images/search?q=south&view=detailv2&&id=7E92863981CCFB89FBDD55205C742DFDA3290CF6&selectedIndex=9&ccid=vzvIfv5u&simid=608055786735667000&thid=OIP.Mbf3bc87efe6e0e476be8cc34bf6cd80eH0" ihk="OIP.Mbf3bc87efe6e0e476be8cc34bf6cd80eH0" t1="South Carolina" t2="747 x 589 · 29 kB · gif" t3="www.digital-topo-maps.com/county-map/south-carolina.shtml" hh="236" hw="300" m='{ns:"images",k:"5117",mid:"7E92863981CCFB89FBDD55205C742DFDA3290CF6",md5:"bf3bc87efe6e0e476be8cc34bf6cd80e",surl:"http://www.digital-topo-maps.com/county-map/south-carolina.shtml",imgurl:"http://www.digital-topo-maps.com/county-map/south-carolina-county-map.gif",tid:"OIP.Mbf3bc87efe6e0e476be8cc34bf6cd80eH0",ow:"480",docid:"608055786735667000",oh:"378",tft:"45"}' mid="7E92863981CCFB89FBDD55205C742DFDA3290CF6" h="ID=images,5117.1">
|
43
|
<img class="img_hid" src2="https://tse4.mm.bing.net/th?id=OIP.Mbf3bc87efe6e0e476be8cc34bf6cd80eH0&w=210&h=154&c=7&rs=1&qlt=90&o=4&pid=1.1" style="width:210px;height:154px;" width="210" height="154">
|
43
|
<img class="img_hid" src2="https://tse4.mm.bing.net/th?id=OIP.Mbf3bc87efe6e0e476be8cc34bf6cd80eH0&w=210&h=154&c=7&rs=1&qlt=90&o=4&pid=1.1" style="width:210px;height:154px;" width="210" height="154">
|
44
|
</a>
|
44
|
</a>
|
45
|
|
45
|
|
46
|
- </div>
|
|
|
|
|
46
|
+ </div></div>
|
47
|
""" # noqa
|
47
|
""" # noqa
|
48
|
html = html.replace('\r\n', '').replace('\n', '').replace('\r', '')
|
48
|
html = html.replace('\r\n', '').replace('\n', '').replace('\r', '')
|
49
|
response = mock.Mock(text=html)
|
49
|
response = mock.Mock(text=html)
|
|
|
|
|
78
|
self.assertEqual(len(results), 0)
|
78
|
self.assertEqual(len(results), 0)
|
79
|
|
79
|
|
80
|
html = """
|
80
|
html = """
|
81
|
- <div class="dg_u" style="width:178px;height:144px;left:17px;top:0px">
|
|
|
|
|
81
|
+ <div class="dg_u" style="width:178px;height:144px;left:17px;top:0px"><div>
|
82
|
<a href="#" ihk="HN.608003696942779811"
|
82
|
<a href="#" ihk="HN.608003696942779811"
|
83
|
m="{ns:"images",k:"5045",
|
83
|
m="{ns:"images",k:"5045",
|
84
|
mid:"659EB92C317974F34517A1CCAEBEF76A578E08DEE",
|
84
|
mid:"659EB92C317974F34517A1CCAEBEF76A578E08DEE",
|
|
|
|
|
89
|
<img src="https://tse4.mm.bing.net/th?id=HN.608003696942779811&o=4&pid=1.7"
|
89
|
<img src="https://tse4.mm.bing.net/th?id=HN.608003696942779811&o=4&pid=1.7"
|
90
|
style="height:144px;" width="178" height="144"/>
|
90
|
style="height:144px;" width="178" height="144"/>
|
91
|
</a>
|
91
|
</a>
|
92
|
- </div>
|
|
|
93
|
- <div class="dg_u" style="width:178px;height:144px;left:17px;top:0px">
|
|
|
|
|
92
|
+ </div></div>
|
|
|
93
|
+ <div class="dg_u" style="width:178px;height:144px;left:17px;top:0px"><div>
|
94
|
<a href="#" ihk="HN.608003696942779811"
|
94
|
<a href="#" ihk="HN.608003696942779811"
|
95
|
m="{ns:"images",k:"5045",
|
95
|
m="{ns:"images",k:"5045",
|
96
|
mid:"659EB92C317974F34517A1CCAEBEF76A578E08DEE",
|
96
|
mid:"659EB92C317974F34517A1CCAEBEF76A578E08DEE",
|
|
|
|
|
101
|
<img src="https://tse4.mm.bing.net/th?id=HN.608003696942779811&o=4&pid=1.7"
|
101
|
<img src="https://tse4.mm.bing.net/th?id=HN.608003696942779811&o=4&pid=1.7"
|
102
|
style="height:144px;" width="178" height="144"/>
|
102
|
style="height:144px;" width="178" height="144"/>
|
103
|
</a>
|
103
|
</a>
|
104
|
- </div>
|
|
|
105
|
- <div class="dg_u" style="width:178px;height:144px;left:17px;top:0px">
|
|
|
|
|
104
|
+ </div></div>
|
|
|
105
|
+ <div class="dg_u" style="width:178px;height:144px;left:17px;top:0px"><div>
|
106
|
<a href="#" ihk="HN.608003696942779811"
|
106
|
<a href="#" ihk="HN.608003696942779811"
|
107
|
m="{ns:"images",k:"5045",
|
107
|
m="{ns:"images",k:"5045",
|
108
|
mid:"659EB92C317974F34517A1CCAEBEF76A578E08DEE",
|
108
|
mid:"659EB92C317974F34517A1CCAEBEF76A578E08DEE",
|
|
|
|
|
113
|
<img src="https://tse4.mm.bing.net/th?id=HN.608003696942779811&o=4&pid=1.7"
|
113
|
<img src="https://tse4.mm.bing.net/th?id=HN.608003696942779811&o=4&pid=1.7"
|
114
|
style="height:144px;" width="178" height="144"/>
|
114
|
style="height:144px;" width="178" height="144"/>
|
115
|
</a>
|
115
|
</a>
|
116
|
- </div>
|
|
|
117
|
- <div class="dg_u" style="width:178px;height:144px;left:17px;top:0px">
|
|
|
118
|
- <a href="#" ihk="HN.608003696942779811"
|
|
|
119
|
- m="{ns:"images",k:"5045",
|
|
|
120
|
-mid:"659EB92C317974F34517A1CCAEBEF76A578E08DEE",
|
|
|
121
|
-surl:"http://www.page.url/",imgurl:"http://test.url/Test%20Query.jpg",
|
|
|
122
|
-oh:"238",tft:"0",oi:"http://www.image.url/Images/Test%20Query.jpg"}"
|
|
|
123
|
- mid="59EB92C317974F34517A1CCAEBEF76A578E08DEE" onclick="return false;"
|
|
|
124
|
- t1="Test Query" t2="650 x 517 · 31 kB · jpeg" t3="www.short.url" h="ID=images,5045.1">
|
|
|
125
|
- <img src="https://tse4.mm.bing.net/th?id=HN.608003696942779811&o=4&pid=1.7"
|
|
|
126
|
- style="height:144px;" width="178" height="144"/>
|
|
|
127
|
- </a>
|
|
|
128
|
- </div>
|
|
|
129
|
- <div class="dg_u" style="width:178px;height:144px;left:17px;top:0px">
|
|
|
130
|
- <a href="#" ihk="HN.608003696942779811"
|
|
|
131
|
- m="{ns:"images",k:"5045",
|
|
|
132
|
-mid:"659EB92C317974F34517A1CCAEBEF76A578E08DEE",
|
|
|
133
|
-surl:"http://www.page.url/",imgurl:"http://test.url/Test%20Query.jpg",
|
|
|
134
|
-oh:"238",tft:"0",oi:"http://www.image.url/Images/Test%20Query.jpg"}"
|
|
|
135
|
- mid="59EB92C317974F34517A1CCAEBEF76A578E08DEE" onclick="return false;"
|
|
|
136
|
- t1="Test Query" t2="650 x 517 · 31 kB · jpeg" t3="www.short.url" h="ID=images,5045.1">
|
|
|
137
|
- <img src="https://tse4.mm.bing.net/th?id=HN.608003696942779811&o=4&pid=1.7"
|
|
|
138
|
- style="height:144px;" width="178" height="144"/>
|
|
|
139
|
- </a>
|
|
|
140
|
- </div>
|
|
|
141
|
- <div class="dg_u" style="width:178px;height:144px;left:17px;top:0px">
|
|
|
142
|
- <a href="#" ihk="HN.608003696942779811"
|
|
|
143
|
- m="{ns:"images",k:"5045",
|
|
|
144
|
-mid:"659EB92C317974F34517A1CCAEBEF76A578E08DEE",
|
|
|
145
|
-surl:"http://www.page.url/",imgurl:"http://test.url/Test%20Query.jpg",
|
|
|
146
|
-oh:"238",tft:"0",oi:"http://www.image.url/Images/Test%20Query.jpg"}"
|
|
|
147
|
- mid="59EB92C317974F34517A1CCAEBEF76A578E08DEE" onclick="return false;"
|
|
|
148
|
- t1="Test Query" t2="650 x 517 · 31 kB · jpeg" t3="www.short.url" h="ID=images,5045.1">
|
|
|
149
|
- <img src="https://tse4.mm.bing.net/th?id=HN.608003696942779811&o=4&pid=1.7"
|
|
|
150
|
- style="height:144px;" width="178" height="144"/>
|
|
|
151
|
- </a>
|
|
|
152
|
- </div>
|
|
|
153
|
- <div class="dg_u" style="width:178px;height:144px;left:17px;top:0px">
|
|
|
154
|
- <a href="#" ihk="HN.608003696942779811"
|
|
|
155
|
- m="{ns:"images",k:"5045",
|
|
|
156
|
-mid:"659EB92C317974F34517A1CCAEBEF76A578E08DEE",
|
|
|
157
|
-surl:"http://www.page.url/",imgurl:"http://test.url/Test%20Query.jpg",
|
|
|
158
|
-oh:"238",tft:"0",oi:"http://www.image.url/Images/Test%20Query.jpg"}"
|
|
|
159
|
- mid="59EB92C317974F34517A1CCAEBEF76A578E08DEE" onclick="return false;"
|
|
|
160
|
- t1="Test Query" t2="650 x 517 · 31 kB · jpeg" t3="www.short.url" h="ID=images,5045.1">
|
|
|
161
|
- <img src="https://tse4.mm.bing.net/th?id=HN.608003696942779811&o=4&pid=1.7"
|
|
|
162
|
- style="height:144px;" width="178" height="144"/>
|
|
|
163
|
- </a>
|
|
|
164
|
- </div>
|
|
|
165
|
- <div class="dg_u" style="width:178px;height:144px;left:17px;top:0px">
|
|
|
166
|
- <a href="#" ihk="HN.608003696942779811"
|
|
|
167
|
- m="{ns:"images",k:"5045",
|
|
|
168
|
-mid:"659EB92C317974F34517A1CCAEBEF76A578E08DEE",
|
|
|
169
|
-surl:"http://www.page.url/",imgurl:"http://test.url/Test%20Query.jpg",
|
|
|
170
|
-oh:"238",tft:"0",oi:"http://www.image.url/Images/Test%20Query.jpg"}"
|
|
|
171
|
- mid="59EB92C317974F34517A1CCAEBEF76A578E08DEE" onclick="return false;"
|
|
|
172
|
- t1="Test Query" t2="650 x 517 · 31 kB · jpeg" t3="www.short.url" h="ID=images,5045.1">
|
|
|
173
|
- <img src="https://tse4.mm.bing.net/th?id=HN.608003696942779811&o=4&pid=1.7"
|
|
|
174
|
- style="height:144px;" width="178" height="144"/>
|
|
|
175
|
- </a>
|
|
|
176
|
- </div>
|
|
|
177
|
- <div class="dg_u" style="width:178px;height:144px;left:17px;top:0px">
|
|
|
178
|
- <a href="#" ihk="HN.608003696942779811"
|
|
|
179
|
- m="{ns:"images",k:"5045",
|
|
|
180
|
-mid:"659EB92C317974F34517A1CCAEBEF76A578E08DEE",
|
|
|
181
|
-surl:"http://www.page.url/",imgurl:"http://test.url/Test%20Query.jpg",
|
|
|
182
|
-oh:"238",tft:"0",oi:"http://www.image.url/Images/Test%20Query.jpg"}"
|
|
|
183
|
- mid="59EB92C317974F34517A1CCAEBEF76A578E08DEE" onclick="return false;"
|
|
|
184
|
- t1="Test Query" t2="650 x 517 · 31 kB · jpeg" t3="www.short.url" h="ID=images,5045.1">
|
|
|
185
|
- <img src="https://tse4.mm.bing.net/th?id=HN.608003696942779811&o=4&pid=1.7"
|
|
|
186
|
- style="height:144px;" width="178" height="144"/>
|
|
|
187
|
- </a>
|
|
|
188
|
- </div>
|
|
|
189
|
- <div class="dg_u" style="width:178px;height:144px;left:17px;top:0px">
|
|
|
190
|
- <a href="#" ihk="HN.608003696942779811"
|
|
|
191
|
- m="{ns:"images",k:"5045",
|
|
|
192
|
-mid:"659EB92C317974F34517A1CCAEBEF76A578E08DEE",
|
|
|
193
|
-surl:"http://www.page.url/",imgurl:"http://test.url/Test%20Query.jpg",
|
|
|
194
|
-oh:"238",tft:"0",oi:"http://www.image.url/Images/Test%20Query.jpg"}"
|
|
|
195
|
- mid="59EB92C317974F34517A1CCAEBEF76A578E08DEE" onclick="return false;"
|
|
|
196
|
- t1="Test Query" t2="650 x 517 · 31 kB · jpeg" t3="www.short.url" h="ID=images,5045.1">
|
|
|
197
|
- <img src="https://tse4.mm.bing.net/th?id=HN.608003696942779811&o=4&pid=1.7"
|
|
|
198
|
- style="height:144px;" width="178" height="144"/>
|
|
|
199
|
- </a>
|
|
|
200
|
- </div>
|
|
|
201
|
- <div class="dg_u" style="width:178px;height:144px;left:17px;top:0px">
|
|
|
202
|
- <a href="#" ihk="HN.608003696942779811"
|
|
|
203
|
- m="{ns:"images",k:"5045",
|
|
|
204
|
-mid:"659EB92C317974F34517A1CCAEBEF76A578E08DEE",
|
|
|
205
|
-surl:"http://www.page.url/",imgurl:"http://test.url/Test%20Query.jpg",
|
|
|
206
|
-oh:"238",tft:"0",oi:"http://www.image.url/Images/Test%20Query.jpg"}"
|
|
|
207
|
- mid="59EB92C317974F34517A1CCAEBEF76A578E08DEE" onclick="return false;"
|
|
|
208
|
- t1="Test Query" t2="650 x 517 · 31 kB · jpeg" t3="www.short.url" h="ID=images,5045.1">
|
|
|
209
|
- <img src="https://tse4.mm.bing.net/th?id=HN.608003696942779811&o=4&pid=1.7"
|
|
|
210
|
- style="height:144px;" width="178" height="144"/>
|
|
|
211
|
- </a>
|
|
|
212
|
- </div>
|
|
|
213
|
- <div class="dg_u" style="width:178px;height:144px;left:17px;top:0px">
|
|
|
214
|
- <a href="#" ihk="HN.608003696942779811"
|
|
|
215
|
- m="{ns:"images",k:"5045",
|
|
|
216
|
-mid:"659EB92C317974F34517A1CCAEBEF76A578E08DEE",
|
|
|
217
|
-surl:"http://www.page.url/",imgurl:"http://test.url/Test%20Query.jpg",
|
|
|
218
|
-oh:"238",tft:"0",oi:"http://www.image.url/Images/Test%20Query.jpg"}"
|
|
|
219
|
- mid="59EB92C317974F34517A1CCAEBEF76A578E08DEE" onclick="return false;"
|
|
|
220
|
- t1="Test Query" t2="650 x 517 · 31 kB · jpeg" t3="www.short.url" h="ID=images,5045.1">
|
|
|
221
|
- <img src="https://tse4.mm.bing.net/th?id=HN.608003696942779811&o=4&pid=1.7"
|
|
|
222
|
- style="height:144px;" width="178" height="144"/>
|
|
|
223
|
- </a>
|
|
|
224
|
- </div>
|
|
|
225
|
- <div class="dg_u" style="width:178px;height:144px;left:17px;top:0px">
|
|
|
226
|
- <a href="#" ihk="HN.608003696942779811"
|
|
|
227
|
- m="{ns:"images",k:"5045",
|
|
|
228
|
-mid:"659EB92C317974F34517A1CCAEBEF76A578E08DEE",
|
|
|
229
|
-surl:"http://www.page.url/",imgurl:"http://test.url/Test%20Query.jpg",
|
|
|
230
|
-oh:"238",tft:"0",oi:"http://www.image.url/Images/Test%20Query.jpg"}"
|
|
|
231
|
- mid="59EB92C317974F34517A1CCAEBEF76A578E08DEE" onclick="return false;"
|
|
|
232
|
- t1="Test Query" t2="650 x 517 · 31 kB · jpeg" t3="www.short.url" h="ID=images,5045.1">
|
|
|
233
|
- <img src="https://tse4.mm.bing.net/th?id=HN.608003696942779811&o=4&pid=1.7"
|
|
|
234
|
- style="height:144px;" width="178" height="144"/>
|
|
|
235
|
- </a>
|
|
|
236
|
- </div>
|
|
|
237
|
- <div class="dg_u" style="width:178px;height:144px;left:17px;top:0px">
|
|
|
238
|
- <a href="#" ihk="HN.608003696942779811"
|
|
|
239
|
- m="{ns:"images",k:"5045",
|
|
|
240
|
-mid:"659EB92C317974F34517A1CCAEBEF76A578E08DEE",
|
|
|
241
|
-surl:"http://www.page.url/",imgurl:"http://test.url/Test%20Query.jpg",
|
|
|
242
|
-oh:"238",tft:"0",oi:"http://www.image.url/Images/Test%20Query.jpg"}"
|
|
|
243
|
- mid="59EB92C317974F34517A1CCAEBEF76A578E08DEE" onclick="return false;"
|
|
|
244
|
- t1="Test Query" t2="650 x 517 · 31 kB · jpeg" t3="www.short.url" h="ID=images,5045.1">
|
|
|
245
|
- <img src="https://tse4.mm.bing.net/th?id=HN.608003696942779811&o=4&pid=1.7"
|
|
|
246
|
- style="height:144px;" width="178" height="144"/>
|
|
|
247
|
- </a>
|
|
|
248
|
- </div>
|
|
|
249
|
- <div class="dg_u" style="width:178px;height:144px;left:17px;top:0px">
|
|
|
250
|
- <a href="#" ihk="HN.608003696942779811"
|
|
|
251
|
- m="{ns:"images",k:"5045",
|
|
|
252
|
-mid:"659EB92C317974F34517A1CCAEBEF76A578E08DEE",
|
|
|
253
|
-surl:"http://www.page.url/",imgurl:"http://test.url/Test%20Query.jpg",
|
|
|
254
|
-oh:"238",tft:"0",oi:"http://www.image.url/Images/Test%20Query.jpg"}"
|
|
|
255
|
- mid="59EB92C317974F34517A1CCAEBEF76A578E08DEE" onclick="return false;"
|
|
|
256
|
- t1="Test Query" t2="650 x 517 · 31 kB · jpeg" t3="www.short.url" h="ID=images,5045.1">
|
|
|
257
|
- <img src="https://tse4.mm.bing.net/th?id=HN.608003696942779811&o=4&pid=1.7"
|
|
|
258
|
- style="height:144px;" width="178" height="144"/>
|
|
|
259
|
- </a>
|
|
|
260
|
- </div>
|
|
|
|
|
116
|
+ </div></div>
|
261
|
"""
|
117
|
"""
|
262
|
html = html.replace('\r\n', '').replace('\n', '').replace('\r', '')
|
118
|
html = html.replace('\r\n', '').replace('\n', '').replace('\r', '')
|
263
|
response = mock.Mock(text=html)
|
119
|
response = mock.Mock(text=html)
|
264
|
results = bing_images.response(response)
|
120
|
results = bing_images.response(response)
|
265
|
self.assertEqual(type(results), list)
|
121
|
self.assertEqual(type(results), list)
|
266
|
- self.assertEqual(len(results), 10)
|
|
|
|
|
122
|
+ self.assertEqual(len(results), 3)
|