mirror of
https://github.com/searxng/searxng.git
synced 2024-12-25 10:40:29 +00:00
Merge pull request #1290 from rinpatch/acgsou-unicode
Fix acgsou encoding error on python2
This commit is contained in:
commit
8a68cd2dcd
2 changed files with 7 additions and 6 deletions
|
@ -63,7 +63,7 @@ def response(resp):
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
# I didn't add download/seed/leech count since as I figured out they are generated randomly everytime
|
# I didn't add download/seed/leech count since as I figured out they are generated randomly everytime
|
||||||
content = 'Category: "{category}".'
|
content = u'Category: "{category}".'
|
||||||
content = content.format(category=category)
|
content = content.format(category=category)
|
||||||
|
|
||||||
results.append({'url': href,
|
results.append({'url': href,
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# coding=utf-8
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
import mock
|
import mock
|
||||||
from searx.engines import acgsou
|
from searx.engines import acgsou
|
||||||
|
@ -19,7 +20,7 @@ class TestAcgsouEngine(SearxTestCase):
|
||||||
resp = mock.Mock(text='<html></html>')
|
resp = mock.Mock(text='<html></html>')
|
||||||
self.assertEqual(acgsou.response(resp), [])
|
self.assertEqual(acgsou.response(resp), [])
|
||||||
|
|
||||||
html = """
|
html = u"""
|
||||||
<html>
|
<html>
|
||||||
<table id="listTable" class="list_style table_fixed">
|
<table id="listTable" class="list_style table_fixed">
|
||||||
<thead class="tcat">
|
<thead class="tcat">
|
||||||
|
@ -37,9 +38,9 @@ class TestAcgsouEngine(SearxTestCase):
|
||||||
<tbody class="tbody" id="data_list">
|
<tbody class="tbody" id="data_list">
|
||||||
<tr class="alt1 ">
|
<tr class="alt1 ">
|
||||||
<td nowrap="nowrap">date</td>
|
<td nowrap="nowrap">date</td>
|
||||||
<td><a href="category.html">testcategory</a></td>
|
<td><a href="category.html">testcategory テスト</a></td>
|
||||||
<td style="text-align:left;">
|
<td style="text-align:left;">
|
||||||
<a href="show-torrentid.html" target="_blank">torrentname</a>
|
<a href="show-torrentid.html" target="_blank">torrentname テスト</a>
|
||||||
</td>
|
</td>
|
||||||
<td>1MB</td>
|
<td>1MB</td>
|
||||||
<td nowrap="nowrap">
|
<td nowrap="nowrap">
|
||||||
|
@ -72,6 +73,6 @@ class TestAcgsouEngine(SearxTestCase):
|
||||||
|
|
||||||
r = results[0]
|
r = results[0]
|
||||||
self.assertEqual(r['url'], 'http://www.acgsou.com/show-torrentid.html')
|
self.assertEqual(r['url'], 'http://www.acgsou.com/show-torrentid.html')
|
||||||
self.assertEqual(r['content'], 'Category: "testcategory".')
|
self.assertEqual(r['content'], u'Category: "testcategory テスト".')
|
||||||
self.assertEqual(r['title'], 'torrentname')
|
self.assertEqual(r['title'], u'torrentname テスト')
|
||||||
self.assertEqual(r['filesize'], 1048576)
|
self.assertEqual(r['filesize'], 1048576)
|
||||||
|
|
Loading…
Reference in a new issue