mirror of
https://github.com/wilsonfreitas/awesome-quant.git
synced 2026-11-02 04:16:10 +00:00
feat: recognize historical README projects
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import importlib.util
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
@@ -7,9 +6,6 @@ from scripts.readme_entries import HISTORICAL_SECTION, iter_readme_entries
|
||||
from scripts.validate_readme import build_duplicate_indexes, validate_entry
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
class HistoricalProjectContractTests(unittest.TestCase):
|
||||
def validate_single_entry(self, line):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
@@ -49,35 +45,3 @@ class HistoricalProjectContractTests(unittest.TestCase):
|
||||
"`Historical` - Archived example retained for its early design."
|
||||
)
|
||||
self.assertIn("language", {issue.code for issue in issues})
|
||||
|
||||
def test_readme_and_site_parser_include_historical_projects(self):
|
||||
spec = importlib.util.spec_from_file_location(
|
||||
"site_generate", ROOT / "site" / "generate.py"
|
||||
)
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
assert spec.loader is not None
|
||||
spec.loader.exec_module(module)
|
||||
|
||||
entries = module.parse_readme(ROOT / "README.md")
|
||||
historical = [
|
||||
entry
|
||||
for entry in entries
|
||||
if entry["category"] == "Historical & Archived Projects"
|
||||
]
|
||||
|
||||
self.assertEqual(
|
||||
{entry["project"] for entry in historical},
|
||||
{"fooltrader", "pipeline-live", "pybacktest"},
|
||||
)
|
||||
self.assertTrue(all("Historical" in entry["languages"] for entry in historical))
|
||||
|
||||
readme = (ROOT / "README.md").read_text(encoding="utf-8")
|
||||
self.assertIn(
|
||||
"- [Historical & Archived Projects](#historical-archived-projects)",
|
||||
readme,
|
||||
)
|
||||
self.assertLess(
|
||||
readme.index("## Historical & Archived Projects"),
|
||||
readme.index("## Related Lists"),
|
||||
)
|
||||
self.assertNotIn("pythalesians", readme)
|
||||
|
||||
Reference in New Issue
Block a user