Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
searx-engine
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
searx-engine
Commits
4340c0b1
Commit
4340c0b1
authored
Nov 07, 2017
by
pyrrh0n1c
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed typos.
parent
2231b02a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
currency_convert.py
searx/engines/currency_convert.py
+5
-5
test_currency_convert.py
tests/unit/engines/test_currency_convert.py
+1
-1
No files found.
searx/engines/currency_convert.py
View file @
4340c0b1
...
@@ -44,15 +44,15 @@ def request(query, params):
...
@@ -44,15 +44,15 @@ def request(query, params):
# wrong query
# wrong query
return
params
return
params
am
m
ount
,
from_currency
,
to_currency
=
m
.
groups
()
amount
,
from_currency
,
to_currency
=
m
.
groups
()
am
mount
=
float
(
am
mount
)
am
ount
=
float
(
a
mount
)
from_currency
=
name_to_iso4217
(
from_currency
.
strip
())
from_currency
=
name_to_iso4217
(
from_currency
.
strip
())
to_currency
=
name_to_iso4217
(
to_currency
.
strip
())
to_currency
=
name_to_iso4217
(
to_currency
.
strip
())
q
=
(
from_currency
+
to_currency
)
.
upper
()
q
=
(
from_currency
+
to_currency
)
.
upper
()
params
[
'url'
]
=
url
.
format
(
from_currency
,
to_currency
)
params
[
'url'
]
=
url
.
format
(
from_currency
,
to_currency
)
params
[
'am
mount'
]
=
am
mount
params
[
'am
ount'
]
=
a
mount
params
[
'from'
]
=
from_currency
params
[
'from'
]
=
from_currency
params
[
'to'
]
=
to_currency
params
[
'to'
]
=
to_currency
params
[
'from_name'
]
=
iso4217_to_name
(
from_currency
,
'en'
)
params
[
'from_name'
]
=
iso4217_to_name
(
from_currency
,
'en'
)
...
@@ -73,9 +73,9 @@ def response(resp):
...
@@ -73,9 +73,9 @@ def response(resp):
return
results
return
results
answer
=
'{0} {1} = {2} {3}, 1 {1} ({5}) = {4} {3} ({6})'
.
format
(
answer
=
'{0} {1} = {2} {3}, 1 {1} ({5}) = {4} {3} ({6})'
.
format
(
resp
.
search_params
[
'am
m
ount'
],
resp
.
search_params
[
'amount'
],
resp
.
search_params
[
'from'
],
resp
.
search_params
[
'from'
],
resp
.
search_params
[
'am
m
ount'
]
*
conversion_rate
,
resp
.
search_params
[
'amount'
]
*
conversion_rate
,
resp
.
search_params
[
'to'
],
resp
.
search_params
[
'to'
],
conversion_rate
,
conversion_rate
,
resp
.
search_params
[
'from_name'
],
resp
.
search_params
[
'from_name'
],
...
...
tests/unit/engines/test_currency_convert.py
View file @
4340c0b1
...
@@ -23,7 +23,7 @@ class TestCurrencyConvertEngine(SearxTestCase):
...
@@ -23,7 +23,7 @@ class TestCurrencyConvertEngine(SearxTestCase):
def
test_response
(
self
):
def
test_response
(
self
):
dicto
=
defaultdict
(
dict
)
dicto
=
defaultdict
(
dict
)
dicto
[
'am
m
ount'
]
=
float
(
10
)
dicto
[
'amount'
]
=
float
(
10
)
dicto
[
'from'
]
=
"GBP"
dicto
[
'from'
]
=
"GBP"
dicto
[
'to'
]
=
"USD"
dicto
[
'to'
]
=
"USD"
dicto
[
'from_name'
]
=
"pound sterling"
dicto
[
'from_name'
]
=
"pound sterling"
...
...
Write
Preview
Markdown
is supported
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