Download tests/test_paths.py from kimjunhan/vkgs-sim: direct link, hf CLI and curl.
- Browser
- Download file 1.39 kB
-
https://huggingface.co/kimjunhan/vkgs-sim/resolve/main/tests/test_paths.py
- Command line
-
hf download hf://kimjunhan/vkgs-sim/tests/test_paths.py
-
curl -L -o test_paths.py https://huggingface.co/kimjunhan/vkgs-sim/resolve/main/tests/test_paths.py
1.39 kB
| """κ²½λ‘ ν΄μ β μ°μ μμμ μ€λ₯ λ©μμ§.""" | |
| import pytest | |
| from nusim.paths import DatasetPaths, nuscenes_root | |
| def _fake_root(tmp_path): | |
| for d in ("v1.0-trainval", "samples", "maps"): | |
| (tmp_path / d).mkdir() | |
| return tmp_path | |
| def test_explicit_wins(tmp_path, monkeypatch): | |
| root = _fake_root(tmp_path) | |
| monkeypatch.setenv("NUSCENES_ROOT", "/does/not/exist") | |
| assert nuscenes_root(root) == root | |
| def test_env_var_used(tmp_path, monkeypatch): | |
| root = _fake_root(tmp_path) | |
| monkeypatch.setenv("NUSCENES_ROOT", str(root)) | |
| assert nuscenes_root() == root | |
| def test_missing_root_lists_what_it_tried(tmp_path, monkeypatch): | |
| monkeypatch.setenv("NUSCENES_ROOT", str(tmp_path / "nope")) | |
| monkeypatch.setattr("nusim.paths._ROOT_CANDIDATES", ()) | |
| monkeypatch.setattr("nusim.paths.workspace_root", lambda: tmp_path) | |
| with pytest.raises(FileNotFoundError) as e: | |
| nuscenes_root() | |
| # μ¬μ©μκ° λ¬΄μμ κ³ μ³μΌ νλμ§ μ μ μμ΄μΌ νλ€ | |
| assert "nope" in str(e.value) | |
| assert "NUSCENES_ROOT" in str(e.value) | |
| def test_subpaths(tmp_path): | |
| root = _fake_root(tmp_path) | |
| d = DatasetPaths(root=root) | |
| assert d.meta == root / "v1.0-trainval" | |
| assert d.map_expansion == root / "maps" / "expansion" | |
| checks = d.check() | |
| assert checks["meta"][0] is True | |
| assert checks["can_bus"][0] is False | |