mirror of
https://github.com/vinta/awesome-python.git
synced 2026-11-20 06:40:51 +00:00
refactor: remove comments that restate the code under website/
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
14eb4a19b8
commit
d58e8d835a
6 changed files with 0 additions and 82 deletions
|
|
@ -65,11 +65,6 @@ class HeadMetadataParser(HTMLParser):
|
|||
self.title += data
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# slugify
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
class TestSlugify:
|
||||
def test_simple(self):
|
||||
assert slugify("Admin Panels") == "admin-panels"
|
||||
|
|
@ -89,11 +84,6 @@ class TestSubcategoryPath:
|
|||
assert subcategory_path("web-frameworks", "synchronous") == "/categories/web-frameworks/synchronous/"
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# build (integration)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
class TestBuild:
|
||||
@pytest.fixture(autouse=True)
|
||||
def _make_sponsorship_md(self, tmp_path):
|
||||
|
|
@ -563,12 +553,10 @@ class TestBuild:
|
|||
""")
|
||||
(tmp_path / "README.md").write_text(readme, encoding="utf-8")
|
||||
|
||||
# Copy real templates
|
||||
real_tpl = Path(__file__).parent / ".." / "templates"
|
||||
tpl_dir = tmp_path / "website" / "templates"
|
||||
shutil.copytree(real_tpl, tpl_dir)
|
||||
|
||||
# Create mock star data
|
||||
data_dir = tmp_path / "website" / "data"
|
||||
data_dir.mkdir(parents=True)
|
||||
stars = {
|
||||
|
|
@ -583,10 +571,8 @@ class TestBuild:
|
|||
# Star-sorted: high-stars (5000) before low-stars (100) before no-stars (None)
|
||||
assert html.index("high-stars") < html.index("low-stars")
|
||||
assert html.index("low-stars") < html.index("no-stars")
|
||||
# Formatted star counts
|
||||
assert "5,000" in html
|
||||
assert "100" in html
|
||||
# Expand content present
|
||||
assert "expand-content" in html
|
||||
|
||||
def test_build_with_downloads_renders_column(self, tmp_path):
|
||||
|
|
@ -1313,11 +1299,6 @@ class TestBuild:
|
|||
build(tmp_path)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# extract_github_repo
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
class TestExtractGithubRepo:
|
||||
def test_github_url(self):
|
||||
assert extract_github_repo("https://github.com/psf/requests") == "psf/requests"
|
||||
|
|
@ -1341,11 +1322,6 @@ class TestExtractGithubRepo:
|
|||
assert extract_github_repo("https://github.com/org") is None
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# sponsor_website_url
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
class TestSponsorWebsiteUrl:
|
||||
def test_replaces_readme_utm_content(self):
|
||||
url = "https://example.com?utm_source=awesome-python&utm_medium=sponsorship&utm_campaign=sponsor&utm_content=readme"
|
||||
|
|
@ -1358,11 +1334,6 @@ class TestSponsorWebsiteUrl:
|
|||
assert sponsor_website_url("https://example.com") == "https://example.com"
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# load_stars
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
class TestLoadStars:
|
||||
def test_returns_empty_when_missing(self, tmp_path):
|
||||
result = load_stars(tmp_path / "nonexistent.json")
|
||||
|
|
@ -1382,11 +1353,6 @@ class TestLoadStars:
|
|||
assert result == {}
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# sort_entries
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
class TestLoadPypiBadges:
|
||||
def test_only_entries_with_a_badge_are_returned(self):
|
||||
badges = load_pypi_badges()
|
||||
|
|
@ -1460,11 +1426,6 @@ class TestSortEntries:
|
|||
assert [e["name"] for e in result] == ["starred", "builtin", "unstarred"]
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# detect_source_type
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
class TestDetectSourceType:
|
||||
def test_github_repo_returns_none(self):
|
||||
assert detect_source_type("https://github.com/psf/requests") is None
|
||||
|
|
@ -1485,11 +1446,6 @@ class TestDetectSourceType:
|
|||
assert detect_source_type("https://github.com/org/repo/wiki") is None
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# extract_entries
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
class TestExtractEntries:
|
||||
def test_basic_extraction(self):
|
||||
readme = textwrap.dedent("""\
|
||||
|
|
@ -1592,11 +1548,6 @@ class TestExtractEntries:
|
|||
]
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# annotate_entries_with_stats
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
class TestAnnotateEntriesWithStats:
|
||||
def test_appends_star_count_to_bullet(self):
|
||||
markdown = "- [foo](https://github.com/owner/foo) - A foo.\n"
|
||||
|
|
@ -1658,11 +1609,6 @@ class TestLoadDownloads:
|
|||
assert load_downloads(tmp_path / "nope.tsv") == {}
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# load_category_intro
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
class TestLoadCategoryIntro:
|
||||
def test_splits_after_how_to_choose_list(self, tmp_path):
|
||||
path = tmp_path / "widgets.md"
|
||||
|
|
|
|||
|
|
@ -166,7 +166,6 @@ class TestMainSkipsFreshCache:
|
|||
|
||||
from fetch_github_stars import main
|
||||
|
||||
# Set up a minimal README with one repo
|
||||
readme = tmp_path / "README.md"
|
||||
readme.write_text("* [req](https://github.com/psf/requests) - HTTP.\n")
|
||||
monkeypatch.setattr("fetch_github_stars.README_PATH", readme)
|
||||
|
|
@ -207,7 +206,6 @@ class TestMainSkipsFreshCache:
|
|||
|
||||
from fetch_github_stars import main
|
||||
|
||||
# Set up a minimal README with one repo
|
||||
readme = tmp_path / "README.md"
|
||||
readme.write_text("* [req](https://github.com/psf/requests) - HTTP.\n")
|
||||
monkeypatch.setattr("fetch_github_stars.README_PATH", readme)
|
||||
|
|
@ -236,7 +234,6 @@ class TestMainSkipsFreshCache:
|
|||
monkeypatch.setattr("fetch_github_stars.DATA_DIR", data_dir)
|
||||
monkeypatch.setenv("GITHUB_TOKEN", "fake-token")
|
||||
|
||||
# Mock httpx.Client to avoid real API calls
|
||||
mock_response = MagicMock()
|
||||
mock_response.json.return_value = {
|
||||
"data": {
|
||||
|
|
|
|||
|
|
@ -529,13 +529,11 @@ class TestParseRealReadme:
|
|||
inline = _find_inline(list_item)
|
||||
if inline is None:
|
||||
continue
|
||||
# Check if inline text starts with '[' but has no link node
|
||||
has_link = any(c.type == "link" for c in inline.children)
|
||||
text = render_inline_text(inline.children)
|
||||
if not has_link and text.startswith("["):
|
||||
line = list_item.map[0] + 1 if list_item.map else "?"
|
||||
bad.append(f" line {line}: {text}")
|
||||
# Recurse into nested lists
|
||||
for child in list_item.children:
|
||||
if child.type == "bullet_list":
|
||||
self._check_list_for_broken_links(child, bad)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue