Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
e
infra
spot
Commits
383e3cc5
Unverified
Commit
383e3cc5
authored
Jan 11, 2019
by
Noémi Ványi
Committed by
GitHub
Jan 11, 2019
Browse files
Merge pull request #1483 from MarcAbonce/wolframalpha_api_fix
[fix] Unicode error with WolframAlpha API engine (fixes #1480)
parents
2438b3c7
626a8e9a
Changes
2
Hide whitespace changes
Inline
Side-by-side
searx/engines/wolframalpha_api.py
View file @
383e3cc5
...
...
@@ -65,7 +65,7 @@ def replace_pua_chars(text):
def
response
(
resp
):
results
=
[]
search_results
=
etree
.
XML
(
resp
.
te
x
t
)
search_results
=
etree
.
XML
(
resp
.
con
te
n
t
)
# return empty array if there are no results
if
search_results
.
xpath
(
failure_xpath
):
...
...
tests/unit/engines/test_wolframalpha_api.py
View file @
383e3cc5
...
...
@@ -35,7 +35,7 @@ class TestWolframAlphaAPIEngine(SearxTestCase):
xml
=
'''<?xml version='1.0' encoding='UTF-8'?>
<queryresult success='false' error='false' />
'''
response
=
mock
.
Mock
(
te
x
t
=
xml
.
encode
(
'utf-8'
))
response
=
mock
.
Mock
(
con
te
n
t
=
xml
.
encode
(
'utf-8'
))
self
.
assertEqual
(
wolframalpha_api
.
response
(
response
),
[])
# test basic case
...
...
@@ -83,7 +83,7 @@ class TestWolframAlphaAPIEngine(SearxTestCase):
</pod>
</queryresult>
"""
response
=
mock
.
Mock
(
te
x
t
=
xml
,
request
=
request
)
response
=
mock
.
Mock
(
con
te
n
t
=
xml
,
request
=
request
)
results
=
wolframalpha_api
.
response
(
response
)
self
.
assertEqual
(
type
(
results
),
list
)
self
.
assertEqual
(
len
(
results
),
2
)
...
...
@@ -144,7 +144,7 @@ class TestWolframAlphaAPIEngine(SearxTestCase):
</pod>
</queryresult>
"""
response
=
mock
.
Mock
(
te
x
t
=
xml
,
request
=
request
)
response
=
mock
.
Mock
(
con
te
n
t
=
xml
,
request
=
request
)
results
=
wolframalpha_api
.
response
(
response
)
self
.
assertEqual
(
type
(
results
),
list
)
self
.
assertEqual
(
len
(
results
),
2
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment