|
@@ -124,8 +124,10 @@ class TestWolframAlphaAPIEngine(SearxTestCase):
|
124
|
124
|
response = mock.Mock(content=xml)
|
125
|
125
|
results = wolframalpha_api.response(response)
|
126
|
126
|
self.assertEqual(type(results), list)
|
127
|
|
- self.assertEqual(len(results), 1)
|
|
127
|
+ self.assertEqual(len(results), 2)
|
128
|
128
|
self.assertIn('i', results[0]['answer'])
|
|
129
|
+ self.assertIn('sqrt(-1) - Wolfram|Alpha', results[1]['title'])
|
|
130
|
+ self.assertEquals('http://www.wolframalpha.com/input/?i=sqrt%28-1%29', results[1]['url'])
|
129
|
131
|
|
130
|
132
|
xml = """<?xml version='1.0' encoding='UTF-8'?>
|
131
|
133
|
<queryresult success='true'
|
|
@@ -223,8 +225,10 @@ class TestWolframAlphaAPIEngine(SearxTestCase):
|
223
|
225
|
response = mock.Mock(content=xml)
|
224
|
226
|
results = wolframalpha_api.response(response)
|
225
|
227
|
self.assertEqual(type(results), list)
|
226
|
|
- self.assertEqual(len(results), 1)
|
|
228
|
+ self.assertEqual(len(results), 2)
|
227
|
229
|
self.assertIn('log(x)+c', results[0]['answer'])
|
|
230
|
+ self.assertIn('∫1/xx - Wolfram|Alpha'.decode('utf-8'), results[1]['title'])
|
|
231
|
+ self.assertEquals('http://www.wolframalpha.com/input/?i=%E2%88%AB1%2Fx%EF%9D%8Cx', results[1]['url'])
|
228
|
232
|
|
229
|
233
|
xml = """<?xml version='1.0' encoding='UTF-8'?>
|
230
|
234
|
<queryresult success='true'
|
|
@@ -233,14 +237,14 @@ class TestWolframAlphaAPIEngine(SearxTestCase):
|
233
|
237
|
datatypes='Solve'
|
234
|
238
|
timedout=''
|
235
|
239
|
timedoutpods=''
|
236
|
|
- timing='0.883'
|
237
|
|
- parsetiming='0.337'
|
|
240
|
+ timing='0.79'
|
|
241
|
+ parsetiming='0.338'
|
238
|
242
|
parsetimedout='false'
|
239
|
243
|
recalculate=''
|
240
|
|
- id='MSPa347225h1ea85fgfbgb4000064ff000d25g5df3f'
|
241
|
|
- host='http://www5a.wolframalpha.com'
|
242
|
|
- server='52'
|
243
|
|
- related='http://www5a.wolframalpha.com/api/v2/relatedQueries.jsp?...'
|
|
244
|
+ id='MSPa7481f7i06d25h3deh2900004810i3a78d9b4fdc'
|
|
245
|
+ host='http://www5b.wolframalpha.com'
|
|
246
|
+ server='23'
|
|
247
|
+ related='http://www5b.wolframalpha.com/api/v2/relatedQueries.jsp?id=...'
|
244
|
248
|
version='2.6'>
|
245
|
249
|
<pod title='Input interpretation'
|
246
|
250
|
scanner='Identity'
|
|
@@ -249,12 +253,7 @@ class TestWolframAlphaAPIEngine(SearxTestCase):
|
249
|
253
|
error='false'
|
250
|
254
|
numsubpods='1'>
|
251
|
255
|
<subpod title=''>
|
252
|
|
- <img src='http://www5a.wolframalpha.com/Calculate/MSP/MSP349225h1ea85fgfbgb400005dhd93b9eegg8f32?...'
|
253
|
|
- alt='solve x^2+x = 0'
|
254
|
|
- title='solve x^2+x = 0'
|
255
|
|
- width='157'
|
256
|
|
- height='35' />
|
257
|
|
- <plaintext>solve x^2+x = 0</plaintext>
|
|
256
|
+ <plaintext>solve x^2+x0</plaintext>
|
258
|
257
|
</subpod>
|
259
|
258
|
</pod>
|
260
|
259
|
<pod title='Results'
|
|
@@ -265,20 +264,10 @@ class TestWolframAlphaAPIEngine(SearxTestCase):
|
265
|
264
|
numsubpods='2'
|
266
|
265
|
primary='true'>
|
267
|
266
|
<subpod title=''>
|
268
|
|
- <img src='http://www5a.wolframalpha.com/Calculate/MSP/MSP350225h1ea85fgfbgb400005b1ebcefaha3ac97?...'
|
269
|
|
- alt='x = -1'
|
270
|
|
- title='x = -1'
|
271
|
|
- width='47'
|
272
|
|
- height='18' />
|
273
|
|
- <plaintext>x = -1</plaintext>
|
|
267
|
+ <plaintext>x-1</plaintext>
|
274
|
268
|
</subpod>
|
275
|
269
|
<subpod title=''>
|
276
|
|
- <img src='http://www5a.wolframalpha.com/Calculate/MSP/MSP351225h1ea85fgfbgb4000032fic0ig981hc936?...'
|
277
|
|
- alt='x = 0'
|
278
|
|
- title='x = 0'
|
279
|
|
- width='36'
|
280
|
|
- height='18' />
|
281
|
|
- <plaintext>x = 0</plaintext>
|
|
270
|
+ <plaintext>x0</plaintext>
|
282
|
271
|
</subpod>
|
283
|
272
|
<states count='1'>
|
284
|
273
|
<state name='Step-by-step solution'
|
|
@@ -292,11 +281,6 @@ class TestWolframAlphaAPIEngine(SearxTestCase):
|
292
|
281
|
error='false'
|
293
|
282
|
numsubpods='1'>
|
294
|
283
|
<subpod title=''>
|
295
|
|
- <img src='http://www5a.wolframalpha.com/Calculate/MSP/MSP352225h1ea85fgfbgb40000464054c665hc5dee?...'
|
296
|
|
- alt=''
|
297
|
|
- title=''
|
298
|
|
- width='300'
|
299
|
|
- height='181' />
|
300
|
284
|
<plaintext></plaintext>
|
301
|
285
|
</subpod>
|
302
|
286
|
</pod>
|
|
@@ -307,11 +291,6 @@ class TestWolframAlphaAPIEngine(SearxTestCase):
|
307
|
291
|
error='false'
|
308
|
292
|
numsubpods='1'>
|
309
|
293
|
<subpod title=''>
|
310
|
|
- <img src='http://www5a.wolframalpha.com/Calculate/MSP/MSP353225h1ea85fgfbgb400005ab1c8aai366fe46?...'
|
311
|
|
- alt=''
|
312
|
|
- title=''
|
313
|
|
- width='310'
|
314
|
|
- height='36' />
|
315
|
294
|
<plaintext></plaintext>
|
316
|
295
|
</subpod>
|
317
|
296
|
</pod>
|
|
@@ -321,6 +300,8 @@ class TestWolframAlphaAPIEngine(SearxTestCase):
|
321
|
300
|
response = mock.Mock(content=xml)
|
322
|
301
|
results = wolframalpha_api.response(response)
|
323
|
302
|
self.assertEqual(type(results), list)
|
324
|
|
- self.assertEqual(len(results), 2)
|
325
|
|
- self.assertIn('x = -1', results[0]['answer'])
|
326
|
|
- self.assertIn('x = 0', results[1]['answer'])
|
|
303
|
+ self.assertEqual(len(results), 3)
|
|
304
|
+ self.assertIn('x=-1', results[0]['answer'])
|
|
305
|
+ self.assertIn('x=0', results[1]['answer'])
|
|
306
|
+ self.assertIn('solve x^2+x0 - Wolfram|Alpha'.decode('utf-8'), results[2]['title'])
|
|
307
|
+ self.assertEquals('http://www.wolframalpha.com/input/?i=solve+x%5E2%2Bx%EF%9F%990', results[2]['url'])
|