summaryrefslogtreecommitdiff
path: root/tests/test_search.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_search.py')
-rw-r--r--tests/test_search.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/tests/test_search.py b/tests/test_search.py
index 4c7eb8b21..4ae3d460f 100644
--- a/tests/test_search.py
+++ b/tests/test_search.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
"""
test_search
~~~~~~~~~~~
@@ -9,12 +8,12 @@
:license: BSD, see LICENSE for details.
"""
+from io import BytesIO
from collections import namedtuple
import pytest
from docutils import frontend, utils
from docutils.parsers import rst
-from six import BytesIO
from sphinx.search import IndexBuilder
from sphinx.util import jsdump
@@ -22,7 +21,7 @@ from sphinx.util import jsdump
DummyEnvironment = namedtuple('DummyEnvironment', ['version', 'domains'])
-class DummyDomain(object):
+class DummyDomain:
def __init__(self, data):
self.data = data
self.object_types = {}
@@ -44,8 +43,9 @@ def setup_module():
def jsload(path):
searchindex = path.text()
assert searchindex.startswith('Search.setIndex(')
+ assert searchindex.endswith(')')
- return jsdump.loads(searchindex[16:-2])
+ return jsdump.loads(searchindex[16:-1])
def is_registered_term(index, keyword):
@@ -65,10 +65,7 @@ test that non-comments are indexed: fermion
@pytest.mark.sphinx(testroot='ext-viewcode')
def test_objects_are_escaped(app, status, warning):
app.builder.build_all()
- searchindex = (app.outdir / 'searchindex.js').text()
- assert searchindex.startswith('Search.setIndex(')
-
- index = jsdump.loads(searchindex[16:-2])
+ index = jsload(app.outdir / 'searchindex.js')
assert 'n::Array&lt;T, d&gt;' in index.get('objects').get('') # n::Array<T,d> is escaped