mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-30 23:57:20 -05:00
feat: search fields and descriptions from pages
This commit is contained in:
1 parent
a93e9ee406
commit
fcb4aa27da
6 files changed
+238
-49
No files matched your search
@@ -103,9 +103,9 @@ class WhatASearchSnippetSays(unittest.TestCase):
|
||||
gs.PAGE_DATA[rel.as_posix()] = {}
|
||||
text = gs._page_description("# Lutro\n", rel, "Lutro")
|
||||
self.assertNotIn("hashes", text)
|
||||
self.assertIn("No BIOS or firmware file is required.", text)
|
||||
self.assertIn("It needs no BIOS or firmware file.", text)
|
||||
gs.PAGE_DATA[rel.as_posix()] = {"hasPart": [{"name": "a.bin"}]}
|
||||
self.assertIn("paths, hashes", gs._page_description("# Lutro\n", rel, "Lutro"))
|
||||
self.assertNotIn("needs no BIOS", gs._page_description("# Lutro\n", rel, "Lutro"))
|
||||
|
||||
def test_a_long_paragraph_is_cut_at_a_word(self):
|
||||
plain = ("files/?sha1= is the address that does not move: it opens the card "
|
||||
|
||||
@@ -179,14 +179,15 @@ class SiteReferenceContracts(unittest.TestCase):
|
||||
self.assertNotIn("\n #if FEATURE", rendered)
|
||||
|
||||
def test_browser_titles_distinguish_emulators_from_system_pages(self):
|
||||
self.assertEqual(
|
||||
_browser_title(Path("emulators/qemu.md"), "QEMU"),
|
||||
"QEMU emulator firmware",
|
||||
)
|
||||
self.assertEqual(
|
||||
_browser_title(Path("systems/qemu.md"), "QEMU"),
|
||||
"QEMU systems",
|
||||
)
|
||||
from unittest import mock # noqa: PLC0415
|
||||
|
||||
import generate_site # noqa: PLC0415
|
||||
|
||||
pages = {"systems/qemu.md": {}, "emulators/qemu.md": {"hasPart": [{"name": "a"}]}}
|
||||
with mock.patch.dict(generate_site.PAGE_DATA, pages, clear=True):
|
||||
self.assertEqual(_browser_title(Path("emulators/qemu.md"), "QEMU"),
|
||||
"QEMU emulator BIOS files")
|
||||
self.assertEqual(_browser_title(Path("systems/qemu.md"), "QEMU"), "QEMU BIOS files")
|
||||
|
||||
ACCEPTED = (
|
||||
("md5", "c87a52c277f7952b41c639fc7bf0a43b"),
|
||||
@@ -581,7 +582,8 @@ class OnlyAPinnedProfileClaimsAPin(unittest.TestCase):
|
||||
with mock.patch.dict(generate_site.PAGE_DATA, pages, clear=True):
|
||||
pinned = generate_site._page_description("", Path("emulators/pinned.md"), "P")
|
||||
loose = generate_site._page_description("", Path("emulators/redream.md"), "R")
|
||||
self.assertIn("source-pinned", pinned)
|
||||
# A search snippet is level 0: the pin is on the page, not in it.
|
||||
self.assertNotIn("source-pinned", pinned)
|
||||
self.assertNotIn("source-pinned", loose)
|
||||
|
||||
|
||||
|
||||
@@ -233,7 +233,7 @@ class ReferenceGrouped(unittest.TestCase):
|
||||
reference = self._reference()
|
||||
groups = {next(iter(item)): next(iter(item.values())) for item in reference
|
||||
if isinstance(item, dict) and isinstance(next(iter(item.values())), list)}
|
||||
self.assertEqual(groups["Checking files"][0], {"Find a file": "files/index.md"})
|
||||
self.assertEqual(groups["Checking files"][0], {"Find or check a file": "files/index.md"})
|
||||
self.assertIn({"What the packs do not hold": "gaps.md"}, groups["Checking files"])
|
||||
self.assertEqual(groups["Data"][:3], [{"Data and API": "data.md"},
|
||||
{"Data model": "wiki/data-model.md"},
|
||||
@@ -250,7 +250,7 @@ class ReferenceGrouped(unittest.TestCase):
|
||||
reference = self._reference(wiki)
|
||||
group = next(item["Checking files"] for item in reference
|
||||
if isinstance(item, dict) and "Checking files" in item)
|
||||
self.assertEqual(group[:2], [{"Find a file": "files/index.md"},
|
||||
self.assertEqual(group[:2], [{"Find or check a file": "files/index.md"},
|
||||
{"How each platform checks files": "wiki/modes.md"}])
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user