mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-25 05:09:03 -05:00
docs: keep neutral wording on every site page
The gaps page called each platform's file a corrected list, a word the exports page test already kept off that page. The test now reads the text of every site generator.
This commit is contained in:
1 parent
a0672d4459
commit
fe652bf508
2 files changed
+38
-6
No files matched your search
@@ -80,5 +80,36 @@ class IconCacheIsReplacedWhole(unittest.TestCase):
|
||||
atomic.assert_called_once()
|
||||
|
||||
|
||||
class EveryPageAddressesPlatformsAsPeers(unittest.TestCase):
|
||||
"""The exports page was held to neutral wording, and the gaps page next
|
||||
to it still called each platform's file a "corrected list". Reads the
|
||||
text every site generator writes, docstrings and bare identifiers aside."""
|
||||
|
||||
WORDS = ("their file", "theirs", "of ours", "corrected", "left out", "drift")
|
||||
SOURCES = ("generate_site.py", "siterender.py", "sitesources.py", "siteexports.py")
|
||||
|
||||
def test_no_page_text_judges_another_project(self):
|
||||
import ast
|
||||
import re
|
||||
|
||||
found = []
|
||||
for name in self.SOURCES:
|
||||
tree = ast.parse((REPO_ROOT / "scripts" / name).read_text(encoding="utf-8"))
|
||||
docstrings = {
|
||||
id(node.body[0].value) for node in ast.walk(tree)
|
||||
if isinstance(node, (ast.Module, ast.ClassDef, ast.FunctionDef,
|
||||
ast.AsyncFunctionDef))
|
||||
and ast.get_docstring(node, clean=False) is not None
|
||||
}
|
||||
for node in ast.walk(tree):
|
||||
if (not isinstance(node, ast.Constant) or not isinstance(node.value, str)
|
||||
or id(node) in docstrings or re.fullmatch(r"\w+", node.value)):
|
||||
continue
|
||||
text = node.value.lower()
|
||||
found += [f"{name}:{node.lineno} {word!r}"
|
||||
for word in self.WORDS if word in text]
|
||||
self.assertEqual(found, [])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user