on master help sign in
Merge pull request #1290 from rinpatch/acgsou-unicode
8a68cd2Adam Tauber
searx/engines/acgsou.py+1−1
@@ -63,7 +63,7 @@ def response(resp):
63 except:
63 except:
64 pass
64 pass
65 # I didn't add download/seed/leech count since as I figured out they are generated randomly everytime
65 # I didn't add download/seed/leech count since as I figured out they are generated randomly everytime
66− content = 'Category: "{category}".'
66+ content = u'Category: "{category}".'
67 content = content.format(category=category)
67 content = content.format(category=category)
68
68
69 results.append({'url': href,
69 results.append({'url': href,
tests/unit/engines/test_acgsou.py+6−5
@@ -1,3 +1,4 @@
1+# coding=utf-8
1from collections import defaultdict
2from collections import defaultdict
2import mock
3import mock
3from searx.engines import acgsou
4from searx.engines import acgsou
@@ -19,7 +20,7 @@ class TestAcgsouEngine(SearxTestCase):
19 resp = mock.Mock(text='<html></html>')
20 resp = mock.Mock(text='<html></html>')
20 self.assertEqual(acgsou.response(resp), [])
21 self.assertEqual(acgsou.response(resp), [])
21
22
22− html = """
23+ html = u"""
23 <html>
24 <html>
24<table id="listTable" class="list_style table_fixed">
25<table id="listTable" class="list_style table_fixed">
25 <thead class="tcat">
26 <thead class="tcat">
@@ -37,9 +38,9 @@ class TestAcgsouEngine(SearxTestCase):
37 <tbody class="tbody" id="data_list">
38 <tbody class="tbody" id="data_list">
38 <tr class="alt1 ">
39 <tr class="alt1 ">
39 <td nowrap="nowrap">date</td>
40 <td nowrap="nowrap">date</td>
40− <td><a href="category.html">testcategory</a></td>
41+ <td><a href="category.html">testcategory テスト</a></td>
41 <td style="text-align:left;">
42 <td style="text-align:left;">
42− <a href="show-torrentid.html" target="_blank">torrentname</a>
43+ <a href="show-torrentid.html" target="_blank">torrentname テスト</a>
43 </td>
44 </td>
44 <td>1MB</td>
45 <td>1MB</td>
45 <td nowrap="nowrap">
46 <td nowrap="nowrap">
@@ -72,6 +73,6 @@ class TestAcgsouEngine(SearxTestCase):
72
73
73 r = results[0]
74 r = results[0]
74 self.assertEqual(r['url'], 'http://www.acgsou.com/show-torrentid.html')
75 self.assertEqual(r['url'], 'http://www.acgsou.com/show-torrentid.html')
75− self.assertEqual(r['content'], 'Category: "testcategory".')
76+ self.assertEqual(r['content'], u'Category: "testcategory テスト".')
76− self.assertEqual(r['title'], 'torrentname')
77+ self.assertEqual(r['title'], u'torrentname テスト')
77 self.assertEqual(r['filesize'], 1048576)
78 self.assertEqual(r['filesize'], 1048576)