Download tests/scrapers/test_ch.py from legexbenchmark/code: direct link, hf CLI and curl.
- Browser
- Download file 1.96 kB
-
https://huggingface.co/datasets/legexbenchmark/code/resolve/main/tests/scrapers/test_ch.py
- Command line
-
hf download hf://datasets/legexbenchmark/code/tests/scrapers/test_ch.py
-
curl -L -o test_ch.py https://huggingface.co/datasets/legexbenchmark/code/resolve/main/tests/scrapers/test_ch.py
1.96 kB
| import pytest | |
| from legex.models.base import Case | |
| from legex.scrapers.ch import CHScraper | |
| def test_parse_case_id(url: str | None, expected: tuple) -> None: | |
| assert CHScraper.parse_case_id(url) == expected | |
| def _case(division: str | None, case_id: str) -> Case: | |
| md = {"division": division} if division else {} | |
| return Case(case_id=case_id, link=f"http://x/{case_id}", jurisdiction="ch", metadata=md) | |
| def test_civil_filter_keeps_4_and_5_drops_rest() -> None: | |
| cases = [_case(d, f"{d}X_1/2020") for d in ["1", "2", "4", "5", "6", None]] | |
| assert [c.case_id for c in CHScraper.civil_filter(cases)] == ["4X_1/2020", "5X_1/2020"] | |