diff --git a/searx/engines/wolframalpha_noapi.py b/searx/engines/wolframalpha_noapi.py
index 0f0315630..71ad3b281 100644
--- a/searx/engines/wolframalpha_noapi.py
+++ b/searx/engines/wolframalpha_noapi.py
@@ -73,11 +73,11 @@ def response(resp):
results.append({'answer': answer})
# user input is in first part of title
- title = dom.xpath(title_xpath)[0].text
+ title = dom.xpath(title_xpath)[0].text.encode('utf-8')
result_url = request(title[:-16], {})['url']
# append result
results.append({'url': result_url,
- 'title': title})
+ 'title': title.decode('utf-8')})
return results
diff --git a/searx/tests/engines/test_wolframalpha_api.py b/searx/tests/engines/test_wolframalpha_api.py
index d9e23182f..98c53f769 100644
--- a/searx/tests/engines/test_wolframalpha_api.py
+++ b/searx/tests/engines/test_wolframalpha_api.py
@@ -30,32 +30,7 @@ class TestWolframAlphaAPIEngine(SearxTestCase):
xml = '''
'''
-
- response = mock.Mock(content=xml)
- self.assertEqual(wolframalpha_api.response(response), [])
-
- xml = """
-
-
-
-
-
- """
-
+ # test failure
response = mock.Mock(content=xml)
self.assertEqual(wolframalpha_api.response(response), [])
@@ -145,14 +120,12 @@ class TestWolframAlphaAPIEngine(SearxTestCase):
"""
+ # test private user area char in response
response = mock.Mock(content=xml)
results = wolframalpha_api.response(response)
self.assertEqual(type(results), list)
- # self.assertEqual(len(results), 2)
self.assertEqual(len(results), 1)
- self.assertIn("i", results[0]['answer'])
- # self.assertIn("sqrt(-1) - Wolfram|Alpha", results[1]['title'])
- # self.assertIn("http://www.wolframalpha.com/input/?i=sqrt%28-1%29", results[1]['url'])
+ self.assertIn('i', results[0]['answer'])
xml = """
"""
+ # test integral
response = mock.Mock(content=xml)
results = wolframalpha_api.response(response)
self.assertEqual(type(results), list)
- # self.assertEqual(len(results), 2)
self.assertEqual(len(results), 1)
- self.assertIn("log(x)+c", results[0]['answer'])
- # self.assertIn("integral 1/x - Wolfram|Alpha", results[1]['title'])
- # self.assertIn("http://www.wolframalpha.com/input/?i=integral+1%2Fx", results[1]['url'])
+ self.assertIn('log(x)+c', results[0]['answer'])
+
+ xml = """
+
+
+
+
+ solve x^2+x = 0
+
+
+
+
+
+ x = -1
+
+
+
+ x = 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ """
+ # test ecuation with multiple answers
+ 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'])
diff --git a/searx/tests/engines/test_wolframalpha_noapi.py b/searx/tests/engines/test_wolframalpha_noapi.py
index 237f578db..3b6314672 100644
--- a/searx/tests/engines/test_wolframalpha_noapi.py
+++ b/searx/tests/engines/test_wolframalpha_noapi.py
@@ -40,7 +40,7 @@ class TestWolframAlphaNoAPIEngine(SearxTestCase):