Download tests/conftest.py from ZipLime/commitments-of-traders: direct link, hf CLI and curl.
- Browser
- Download file 1.08 kB
-
https://huggingface.co/datasets/ZipLime/commitments-of-traders/resolve/main/tests/conftest.py
- Command line
-
hf download hf://datasets/ZipLime/commitments-of-traders/tests/conftest.py
-
curl -L -o conftest.py https://huggingface.co/datasets/ZipLime/commitments-of-traders/resolve/main/tests/conftest.py
1.08 kB
| """Fixtures: the CFTC's own pages, and a slice of each annual archive. | |
| The two HTML pages are stored whole, because they are what the release instants | |
| are read from and every one of their quirks matters. The archives are stored as | |
| a slice -- fourteen markets and every week of them -- since a full year is eight | |
| megabytes and the parser does not care how many markets are in the file. | |
| The three archives are chosen for what is different about them: the legacy | |
| report spells its columns one way and the disaggregated another, and the 2010 | |
| file dates its rows `12/31/2010` where every later file writes `2010-12-31`. | |
| """ | |
| from __future__ import annotations | |
| import gzip | |
| from pathlib import Path | |
| import pytest | |
| FIXTURES = Path(__file__).parent / "fixtures" | |
| def load_page(name: str) -> str: | |
| return gzip.decompress((FIXTURES / "schedule" / name).read_bytes()).decode("utf-8") | |
| def load_archive(name: str) -> bytes: | |
| return (FIXTURES / "archives" / name).read_bytes() | |
| def page(): | |
| return load_page | |
| def archive(): | |
| return load_archive | |