From 2a15944b58089d84a930f36b42c6ef60d4e629b3 Mon Sep 17 00:00:00 2001 From: a01200356 Date: Sun, 3 Jan 2016 22:03:33 -0600 Subject: [fix] test in wolframalpha_noapi --- searx/tests/engines/test_wolframalpha_noapi.py | 38 ++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) (limited to 'searx/tests/engines/test_wolframalpha_noapi.py') diff --git a/searx/tests/engines/test_wolframalpha_noapi.py b/searx/tests/engines/test_wolframalpha_noapi.py index 3b6314672..cad9593f2 100644 --- a/searx/tests/engines/test_wolframalpha_noapi.py +++ b/searx/tests/engines/test_wolframalpha_noapi.py @@ -149,11 +149,45 @@ class TestWolframAlphaNoAPIEngine(SearxTestCase): """ - # test output in htmlentity + # test output with htmlentity response = mock.Mock(text=html) results = wolframalpha_noapi.response(response) self.assertEqual(type(results), list) self.assertEqual(len(results), 2) - self.assertIn("¥".decode('utf-8'), results[0]['answer']) + self.assertIn('¥'.decode('utf-8'), results[0]['answer']) self.assertIn('1 euro to yen - Wolfram|Alpha', results[1]['title']) self.assertEquals('http://www.wolframalpha.com/input/?i=+1+euro+to+yen', results[1]['url']) + + html = """ + + distance from nairobi to kyoto in inches - Wolfram|Alpha + + + + + + """ + # test output with utf-8 character + response = mock.Mock(text=html) + results = wolframalpha_noapi.response(response) + self.assertEqual(type(results), list) + self.assertEqual(len(results), 2) + self.assertIn('4.295×10^8 inches'.decode('utf-8'), results[0]['answer']) + self.assertIn('distance from nairobi to kyoto in inches - Wolfram|Alpha', results[1]['title']) + self.assertEquals('http://www.wolframalpha.com/input/?i=+distance+from+nairobi+to+kyoto+in+inches', + results[1]['url']) -- cgit v1.2.3