|
@@ -95,14 +95,14 @@ class TestWikidataEngine(SearxTestCase):
|
95
|
95
|
|
96
|
96
|
results = wikidata.getDetail(response, "Q123", "yua", "yua_MX")
|
97
|
97
|
self.assertEqual(len(results), 2)
|
98
|
|
- self.assertEqual(results[0]['title'], 'official website')
|
|
98
|
+ self.assertEqual(results[0]['title'], 'Official website')
|
99
|
99
|
self.assertEqual(results[0]['url'], 'https://officialsite.com')
|
100
|
100
|
|
101
|
101
|
self.assertEqual(results[1]['infobox'], 'Test')
|
102
|
102
|
self.assertEqual(results[1]['id'], None)
|
103
|
103
|
self.assertEqual(results[1]['content'], 'Description')
|
104
|
104
|
self.assertEqual(results[1]['attributes'], [])
|
105
|
|
- self.assertEqual(results[1]['urls'][0]['title'], 'official website')
|
|
105
|
+ self.assertEqual(results[1]['urls'][0]['title'], 'Official website')
|
106
|
106
|
self.assertEqual(results[1]['urls'][0]['url'], 'https://officialsite.com')
|
107
|
107
|
self.assertEqual(results[1]['urls'][1]['title'], 'Wikipedia (en)')
|
108
|
108
|
self.assertEqual(results[1]['urls'][1]['url'], 'https://en.wikipedia.org/wiki/Test')
|
|
@@ -141,7 +141,8 @@ class TestWikidataEngine(SearxTestCase):
|
141
|
141
|
html_etree = fromstring(html)
|
142
|
142
|
|
143
|
143
|
image_src = wikidata.add_image(html_etree)
|
144
|
|
- self.assertEqual(image_src, "https://commons.wikimedia.org/wiki/Special:FilePath/image.png?width=500")
|
|
144
|
+ self.assertEqual(image_src,
|
|
145
|
+ "https://commons.wikimedia.org/wiki/Special:FilePath/image.png?width=500&height=400")
|
145
|
146
|
|
146
|
147
|
html = u"""
|
147
|
148
|
<div>
|
|
@@ -196,7 +197,8 @@ class TestWikidataEngine(SearxTestCase):
|
196
|
197
|
html_etree = fromstring(html)
|
197
|
198
|
|
198
|
199
|
image_src = wikidata.add_image(html_etree)
|
199
|
|
- self.assertEqual(image_src, "https://commons.wikimedia.org/wiki/Special:FilePath/logo.png?width=500")
|
|
200
|
+ self.assertEqual(image_src,
|
|
201
|
+ "https://commons.wikimedia.org/wiki/Special:FilePath/logo.png?width=500&height=400")
|
200
|
202
|
|
201
|
203
|
def test_add_attribute(self):
|
202
|
204
|
html = u"""
|
|
@@ -234,7 +236,7 @@ class TestWikidataEngine(SearxTestCase):
|
234
|
236
|
|
235
|
237
|
wikidata.add_attribute(attributes, html_etree, "P27")
|
236
|
238
|
self.assertEqual(len(attributes), 1)
|
237
|
|
- self.assertEqual(attributes[0]["label"], "country of citizenship")
|
|
239
|
+ self.assertEqual(attributes[0]["label"], "Country of citizenship")
|
238
|
240
|
self.assertEqual(attributes[0]["value"], "United Kingdom")
|
239
|
241
|
|
240
|
242
|
html = u"""
|
|
@@ -269,7 +271,7 @@ class TestWikidataEngine(SearxTestCase):
|
269
|
271
|
html_etree = fromstring(html)
|
270
|
272
|
wikidata.add_attribute(attributes, html_etree, "P569", date=True)
|
271
|
273
|
self.assertEqual(len(attributes), 1)
|
272
|
|
- self.assertEqual(attributes[0]["label"], "date of birth")
|
|
274
|
+ self.assertEqual(attributes[0]["label"], "Date of birth")
|
273
|
275
|
self.assertEqual(attributes[0]["value"], "27 January 1832")
|
274
|
276
|
|
275
|
277
|
html = u"""
|
|
@@ -317,7 +319,7 @@ class TestWikidataEngine(SearxTestCase):
|
317
|
319
|
html_etree = fromstring(html)
|
318
|
320
|
wikidata.add_attribute(attributes, html_etree, "P6")
|
319
|
321
|
self.assertEqual(len(attributes), 1)
|
320
|
|
- self.assertEqual(attributes[0]["label"], "head of government")
|
|
322
|
+ self.assertEqual(attributes[0]["label"], "Head of government")
|
321
|
323
|
self.assertEqual(attributes[0]["value"], "Old Prime Minister, Actual Prime Minister")
|
322
|
324
|
|
323
|
325
|
attributes = []
|
|
@@ -355,7 +357,7 @@ class TestWikidataEngine(SearxTestCase):
|
355
|
357
|
html_etree = fromstring(html)
|
356
|
358
|
wikidata.add_url(urls, html_etree, 'P856')
|
357
|
359
|
self.assertEquals(len(urls), 1)
|
358
|
|
- self.assertIn({'title': 'official website', 'url': 'https://searx.me/'}, urls)
|
|
360
|
+ self.assertIn({'title': 'Official website', 'url': 'https://searx.me/'}, urls)
|
359
|
361
|
urls = []
|
360
|
362
|
results = []
|
361
|
363
|
wikidata.add_url(urls, html_etree, 'P856', 'custom label', results=results)
|
|
@@ -403,8 +405,8 @@ class TestWikidataEngine(SearxTestCase):
|
403
|
405
|
html_etree = fromstring(html)
|
404
|
406
|
wikidata.add_url(urls, html_etree, 'P856')
|
405
|
407
|
self.assertEquals(len(urls), 2)
|
406
|
|
- self.assertIn({'title': 'official website', 'url': 'http://www.worldofwarcraft.com'}, urls)
|
407
|
|
- self.assertIn({'title': 'official website', 'url': 'http://eu.battle.net/wow/en/'}, urls)
|
|
408
|
+ self.assertIn({'title': 'Official website', 'url': 'http://www.worldofwarcraft.com'}, urls)
|
|
409
|
+ self.assertIn({'title': 'Official website', 'url': 'http://eu.battle.net/wow/en/'}, urls)
|
408
|
410
|
|
409
|
411
|
def test_get_imdblink(self):
|
410
|
412
|
html = u"""
|