Skip to content

Commit

Permalink
Fix test_search
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Aug 16, 2024
1 parent 60522f5 commit 0bbc43d
Showing 1 changed file with 26 additions and 10 deletions.
36 changes: 26 additions & 10 deletions tests/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,19 @@
]


class DummyDomainsContainer:
def __init__(self, domains):
self._domain_instances = domains

def sorted_domains(self):
for _domain_name, domain in sorted(self._domain_instances.items()):
yield domain


class DummyEnvironment:
def __init__(self, version, domains):
self.version = version
self.domains = domains
self.domains = DummyDomainsContainer(domains)

def __getattr__(self, name):
if name.startswith('_search_index_'):
Expand All @@ -36,7 +45,8 @@ def __str__(self):


class DummyDomain:
def __init__(self, data):
def __init__(self, name, data):
self.name = name
self.data = data
self.object_types = {}

Expand Down Expand Up @@ -162,14 +172,20 @@ def test_term_in_raw_directive(app):


def test_IndexBuilder():
domain1 = DummyDomain([
('objname1', 'objdispname1', 'objtype1', 'docname1_1', '#anchor', 1),
('objname2', 'objdispname2', 'objtype2', 'docname1_2', '', -1),
])
domain2 = DummyDomain([
('objname1', 'objdispname1', 'objtype1', 'docname2_1', '#anchor', 1),
('objname2', 'objdispname2', 'objtype2', 'docname2_2', '', -1),
])
domain1 = DummyDomain(
'dummy1',
[
('objname1', 'objdispname1', 'objtype1', 'docname1_1', '#anchor', 1),
('objname2', 'objdispname2', 'objtype2', 'docname1_2', '', -1),
],
)
domain2 = DummyDomain(
'dummy2',
[
('objname1', 'objdispname1', 'objtype1', 'docname2_1', '#anchor', 1),
('objname2', 'objdispname2', 'objtype2', 'docname2_2', '', -1),
],
)
env = DummyEnvironment('1.0', {'dummy1': domain1, 'dummy2': domain2})
doc = utils.new_document(b'test data', settings)
doc['file'] = 'dummy'
Expand Down

0 comments on commit 0bbc43d

Please sign in to comment.