fix: complete language version IDs for all platforms (#350)
## Problem `LANGUAGE_VERSIONS` only covered cpp and python. Several platform IDs were wrong — CodeChef used `C++ 17`/`Python 3` (correct: `C++`/`PYTH 3`), USACO listed nonexistent c++20/c++23 options, and CSES only had C++17. ## Solution Verify every platform's submit page and update all language ID tables. Add java and rust entries where supported, fix incorrect CodeChef and USACO IDs, and expand CSES `CSES_LANGUAGES` dict with C++11/C++20/PyPy3/Java/Rust variants.
This commit is contained in:
parent
2776aaeb21
commit
425a8f36e9
5 changed files with 64 additions and 34 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import pytest
|
||||
|
||||
from scrapers.language_ids import LANGUAGE_IDS, get_language_id
|
||||
from scrapers.language_ids import LANGUAGE_IDS
|
||||
from scrapers.models import (
|
||||
ContestListResult,
|
||||
MetadataResult,
|
||||
|
|
@ -140,26 +140,17 @@ def test_scraper_metadata_error(run_scraper_offline, scraper, contest_id):
|
|||
assert objs[-1].get("error")
|
||||
|
||||
|
||||
EXPECTED_PLATFORMS = {"atcoder", "codeforces", "cses", "usaco", "kattis", "codechef"}
|
||||
EXPECTED_LANGUAGES = {"cpp", "python"}
|
||||
|
||||
|
||||
def test_language_ids_coverage():
|
||||
assert set(LANGUAGE_IDS.keys()) == EXPECTED_PLATFORMS
|
||||
expected_platforms = {
|
||||
"atcoder",
|
||||
"codeforces",
|
||||
"cses",
|
||||
"usaco",
|
||||
"kattis",
|
||||
"codechef",
|
||||
}
|
||||
assert set(LANGUAGE_IDS.keys()) == expected_platforms
|
||||
for platform, langs in LANGUAGE_IDS.items():
|
||||
assert set(langs.keys()) == EXPECTED_LANGUAGES, f"{platform} missing languages"
|
||||
assert {"cpp", "python"} <= set(langs.keys()), f"{platform} missing cpp/python"
|
||||
for lang, lid in langs.items():
|
||||
assert isinstance(lid, str) and lid, f"{platform}/{lang} empty ID"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("platform", EXPECTED_PLATFORMS)
|
||||
@pytest.mark.parametrize("language", EXPECTED_LANGUAGES)
|
||||
def test_get_language_id(platform, language):
|
||||
result = get_language_id(platform, language)
|
||||
assert result is not None, f"No ID for {platform}/{language}"
|
||||
assert result == LANGUAGE_IDS[platform][language]
|
||||
|
||||
|
||||
def test_get_language_id_unknown():
|
||||
assert get_language_id("nonexistent", "cpp") is None
|
||||
assert get_language_id("codeforces", "rust") is None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue