From 8ca574481485847d5e0f47627d20c543c39b7b66 Mon Sep 17 00:00:00 2001 From: a01200356 Date: Tue, 5 Jan 2016 21:47:31 -0600 Subject: append link to result in wolframalpha_api (and the tests to validate that) --- searx/tests/engines/test_wolframalpha_api.py | 59 ++++++++++------------------ 1 file changed, 20 insertions(+), 39 deletions(-) (limited to 'searx/tests/engines/test_wolframalpha_api.py') diff --git a/searx/tests/engines/test_wolframalpha_api.py b/searx/tests/engines/test_wolframalpha_api.py index 98c53f769..c80775795 100644 --- a/searx/tests/engines/test_wolframalpha_api.py +++ b/searx/tests/engines/test_wolframalpha_api.py @@ -124,8 +124,10 @@ class TestWolframAlphaAPIEngine(SearxTestCase): response = mock.Mock(content=xml) results = wolframalpha_api.response(response) self.assertEqual(type(results), list) - self.assertEqual(len(results), 1) + self.assertEqual(len(results), 2) self.assertIn('i', results[0]['answer']) + self.assertIn('sqrt(-1) - Wolfram|Alpha', results[1]['title']) + self.assertEquals('http://www.wolframalpha.com/input/?i=sqrt%28-1%29', results[1]['url']) xml = """ - solve x^2+x = 0 - solve x^2+x = 0</plaintext> + <plaintext>solve x^2+x0</plaintext> </subpod> </pod> <pod title='Results' @@ -265,20 +264,10 @@ class TestWolframAlphaAPIEngine(SearxTestCase): numsubpods='2' primary='true'> <subpod title=''> - <img src='http://www5a.wolframalpha.com/Calculate/MSP/MSP350225h1ea85fgfbgb400005b1ebcefaha3ac97?...' - alt='x = -1' - title='x = -1' - width='47' - height='18' /> - <plaintext>x = -1</plaintext> + <plaintext>x-1</plaintext> </subpod> <subpod title=''> - <img src='http://www5a.wolframalpha.com/Calculate/MSP/MSP351225h1ea85fgfbgb4000032fic0ig981hc936?...' - alt='x = 0' - title='x = 0' - width='36' - height='18' /> - <plaintext>x = 0</plaintext> + <plaintext>x0</plaintext> </subpod> <states count='1'> <state name='Step-by-step solution' @@ -292,11 +281,6 @@ class TestWolframAlphaAPIEngine(SearxTestCase): error='false' numsubpods='1'> <subpod title=''> - <img src='http://www5a.wolframalpha.com/Calculate/MSP/MSP352225h1ea85fgfbgb40000464054c665hc5dee?...' - alt='' - title='' - width='300' - height='181' /> <plaintext></plaintext> </subpod> </pod> @@ -307,11 +291,6 @@ class TestWolframAlphaAPIEngine(SearxTestCase): error='false' numsubpods='1'> <subpod title=''> - <img src='http://www5a.wolframalpha.com/Calculate/MSP/MSP353225h1ea85fgfbgb400005ab1c8aai366fe46?...' - alt='' - title='' - width='310' - height='36' /> <plaintext></plaintext> </subpod> </pod> @@ -321,6 +300,8 @@ class TestWolframAlphaAPIEngine(SearxTestCase): response = mock.Mock(content=xml) results = wolframalpha_api.response(response) self.assertEqual(type(results), list) - self.assertEqual(len(results), 2) - self.assertIn('x = -1', results[0]['answer']) - self.assertIn('x = 0', results[1]['answer']) + self.assertEqual(len(results), 3) + self.assertIn('x=-1', results[0]['answer']) + self.assertIn('x=0', results[1]['answer']) + self.assertIn('solve x^2+x0 - Wolfram|Alpha'.decode('utf-8'), results[2]['title']) + self.assertEquals('http://www.wolframalpha.com/input/?i=solve+x%5E2%2Bx%EF%9F%990', results[2]['url']) -- cgit v1.2.3